学习参考 https://www.jianshu.com/p/815c3810c7a4
仿照 antd写法,安装npm i -D less less-loader
莫名其妙报错了,如下:
ERROR in ./node_modules/antd/lib/button/style/index.less (./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./node_modules/antd/lib/button/style/index.less)
Module build failed (from ./node_modules/less-loader/dist/cjs.js):
ValidationError: Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'javascriptEnabled'. These properties are valid:
object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation? }
at validate (C:\Users\87715\study\node_modules\schema-utils\dist\validate.js:105:11)
at Object.lessLoader (C:\Users\87715\study\node_modules\less-loader\dist\index.js:26:29)
@ ./node_modules/antd/lib/button/style/index.less 61:4-74:5 8:6-160 22:17-24 26:7-21 58:25-39 59:36-47 59:50-64 63:6-73:7 64:54-65 64:68-82 70:42-53 70:56-70 72:21-28 83:0-130 83:0-130 84:22-29 84:33-47 84:50-64
@ ./node_modules/antd/lib/button/style/index.js 5:0-23
@ ./src/index.tsx 1:0-31
ERROR in ./node_modules/antd/lib/style/default.less (./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./node_modules/antd/lib/style/default.less)
Module build failed (from ./node_modules/less-loader/dist/cjs.js):
ValidationError: Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'javascriptEnabled'. These properties are valid:
object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation? }
at validate (C:\Users\87715\study\node_modules\schema-utils\dist\validate.js:105:11)
at Object.lessLoader (C:\Users\87715\study\node_modules\less-loader\dist\index.js:26:29)
@ ./node_modules/antd/lib/style/default.less 8:6-156 22:17-24 26:7-21 58:25-39 59:36-47 59:50-64 63:6-73:7 64:54-65 64:68-82 70:42-53 70:56-70 72:21-28 83:0-126 83:0-126 84:22-29 84:33-47 84:50-64 61:4-74:5
@ ./node_modules/antd/lib/button/style/index.js 3:0-35
@ ./src/index.tsx 1:0-31
问到度娘 有https://blog.csdn.net/weixin_38049458/article/details/79222315
这问题很相似,试试执行还不行
折磨还是折磨大半天
最后卸载 npm uninstall less less-loader
后来 不想再安装,干脆直接执行一下,通过!!!
没有less less-loader,没有异常
醉了。。。
卸载后已经没有less,对吗?还是通啊!求教!orz