用vue3.7.0重做尚硅谷外卖项目。
44:退出登陆。
填入以下内容:
module.exports = {
presets: [
'@vue/app'
],
"plugins": [
[
"component",
{
"libraryName": "mint-ui",
"style": "true"
}
]
]
}
结果报错:
This dependency was not found:
* mint-ui/lib/button/true in ./src/main.js
To install it, you can run: npm install --save mint-ui/lib/button/true
我实在是不会webpack和babel,特别是现在又升级了webpack4和babel7……还有vue3.7.0……完全面目全非。
网络查找还是没有结果……
查看以下内容:
https://wenda.so.com/q/1534278835211827
里面讲的稍微详细一点……原谅我,我真的不懂这些……
然后反复尝试后发现:不需要 "style": "true"
也就是这样:
babel.config.js:
module.exports = {
presets: [
'@vue/app'
],
"plugins": [
[
"component",
{
"libraryName": "mint-ui"
}
]
]
}
就可以了
不过,接下来再做,还是反复出现问题,我搞不清楚原因
"style": "true"加入也可以
不过,如果出现以下问题
.plugins[0][1] must be an object, false, or undefined
貌似是因为component后不需要中括号
如果是出现
Rolling back node-pre-gyp@0.12.0 failed (this is probably harmless): EPERM: operation not permitted, lstat 'D:\demo\gshop\gshop\node_modules\fsevents\node_modules'
那么貌似是要npm un 然后npm i……
最后,babel.config.js有没有style都可以?
以下也可以,我真的搞不清楚,希望以后更进一步学习一下webpack和babel,老是升级,乱七八糟的
虽然是写的乱,也不删文章,因为这个地方总是出错,所以留下来做参考
module.exports = {
presets: [
'@vue/app'
],
"plugins": [
[
"component",
[{
"libraryName": "mint-ui",
"style": true
}]
]
]
}
还有,main.js
import {Button} from 'mint-ui'
//全局注册组件
Vue.component(Button.name, Button) // <mt-button>