使用vue-cli构建的项目,之前引入mint-ui的css文件是正常的。
使用babel-plugin-component插件后却报错。错误代码如下
Module not found: Error: Cannot resolve module 'mint-ui/style.css'
我的代码
import MintUI from 'mint-ui'
Vue.use(MintUI)
babelrc也配置过了
{
"presets": ["es2015", "stage-2"],
"plugins": ["transform-runtime", ["component", [
{ "libraryName": "mint-ui", "style": true }
]]],
"comments": false
}
你这个不是按需引用的写法,如果babel的配置文件里已经有:
那么不应再用这种全局插件引入的方式:
而是应该在需要使用的时候引入: