electron-vue 引入 vue.ant.design报错

vue

 ERROR in ./node_modules/ant-design-vue/dist/antd.less (./node_modules/css-loader!./node_modules/less-loader/dist/cjs.js!./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?

in D:\demo\my-project\node_modules\ant-design-vue\lib\style\color\bezierEasing.less (line 110, column 0)

@ ./node_modules/ant-design-vue/dist/antd.less 4:14-94 14:3-18:5 15:22-102

@ ./src/renderer/main.js

@ multi ./.electron-vue/dev-client ./src/renderer/main.js

解决办法:

https://github.com/ant-design/ant-motion/issues/44

在webpack.renderer.config.js

修改 less的配置

原来:

{

test: /\.less$/,

use: ['vue-style-loader', 'css-loader', 'less-loader']

},

修改为:

{

test: /\.less$/,

use: [

{

loader: "style-loader"

},

{

loader: "css-loader",

options: {

importLoaders: 1

}

},

{

loader: "less-loader",

options: {

javascriptEnabled: true

}

}

]

}

刚开始可能还没有安装less 和 loader-less,node-less需要自己安装

有可能是less的问题, "less": "^2.7.3", "less-loader": "^4.1.0", 把less版本降到3.0以下,我这边就没问题了。

重新做了

以上是 electron-vue 引入 vue.ant.design报错 的全部内容, 来源链接: utcz.com/z/378373.html

回到顶部