当我们使用ant-design-vue组件时,想要设置主题样式,想引用ant-design-vue/dist/antd.less,可是出现如下报错。
./node_modules/ant-design-vue/dist/antd.less (./node_modules/css-loader/dist/cjs.js??ref–10-oneOf-3-1!./node_modules/postcss-loader/src??ref–10-oneOf-3-2!./node_modules/less-loader/dist/cjs.js??ref–10-oneOf-3-3!./node_modules/ant-design-vue/dist/antd.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?

那么我们可以通过在项目中创建一个vue.config.js文件,并写入

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

然后重启项目就解决了!

Logo

前往低代码交流专区

更多推荐