Vue按需引入Ant Design报错“error in ./node_modules/ant-design-vue/es/empty/style/index.less”解决办法
一、报错如下:errorin ./node_modules/ant-design-vue/es/empty/style/index.less@ ./node_modules/ant-design-vue/es/select/style/index.less 4:14-207 14:3-18:5 15:22-215@ ./node_modules/ant-design-vue/es/select/s
·
一、报错如下:
error in ./node_modules/ant-design-vue/es/empty/style/index.less
@ ./node_modules/ant-design-vue/es/select/style/index.less 4:14-207 14:3-18:5 15:22-215
@ ./node_modules/ant-design-vue/es/select/style/index.js
@ ./node_modules/ant-design-vue/es/pagination/style/index.js
@ ./src/plugins/ant-design-vue.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://192.168.1.192:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
二、解决方案
1、安装less和less-loader
npm install less less-loader --save
2、修改babel.config.js
- 将其中的style: true修改为"style": “css”,修改后内容如下
module.exports = {
"presets": [
"@vue/cli-plugin-babel/preset"
],
"plugins": [
[
"import",
{
"libraryName": "ant-design-vue",
"libraryDirectory": "es",
"style": "css"
}
]
]
}
三、修改后项目成功运行
更多推荐
已为社区贡献5条内容
所有评论(0)