vue引入ant-design-vue按需加载编译报错信息

 error  in ./node_modules/ant-design-vue/es/style/index.less
Module build failed (from ./node_modules/less-loader/dist/cjs.js):
// https://github.com/ant-design/ant-motion/issues/44
.bezierEasingMixin();
^
Inline JavaScript is not enabled. Is it set in your options?
      in C:\2020code\VUE\antd-vue-admin\node_modules\ant-design-vue\es\style\color\bezierEasing.less (line 110, column 0)
 @ ./node_modules/ant-design-vue/es/style/index.less 4:14-198 14:3-18:5 15:22-206
 @ ./node_modules/ant-design-vue/es/button/style/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.0.103:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

解决方法:

第一步:
在根文件夹中创建 vue.config.js

第二步:添加

module.exports = {
  css: {
    loaderOptions: {
      less: {
        javascriptEnabled: true
      }
    }
  }
}

第三步:
重新运行vue命令

Logo

前往低代码交流专区

更多推荐