Closed
Description
完全根据文档做下来的,试的新建好几个项目了,还是不行。有大神指导一下什么原因吗?
报错信息如下:
Failed to compile
./src/Home/less/antMotionStyle.less (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-7-1!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dist/cjs.js??ref--6-oneOf-7-3!./src/Home/less/antMotionStyle.less)
ValidationError: Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.
Activity
Burning-Shadow commentedon May 4, 2020
插个眼同问 :(
vanishcode commentedon May 4, 2020
temporary way to fix this problem:ant-design/ant-design#23624 😢
remove less-loader@6.0.0 and install less-loader@5.0.0 fixed on me.
Burning-Shadow commentedon May 4, 2020
啊我也刚看到这里。6.0刚出好像兼容方面有点问题,改成
就好了
jaybolee commentedon May 6, 2020
谢谢,更换为less-loader@5.0.0 重新build后成功了。谢谢大佬
pitops commentedon May 7, 2020
Have the same issue, any updates?
eDubrovsky commentedon May 8, 2020
@pitops upgrade to customize-cra@next (1.0.0-alpha.0) helps for me
ozgursoy commentedon May 8, 2020
+1
jaybolee commentedon May 9, 2020
@pitops change the less-loader version from 6.0 to 5.0, then restart it.
$ yarn remove less-loader
$ yarn add less-loader@5.0.0
$ yarn start
cosoc commentedon May 13, 2020
如果使用6.x
如下配置
参考地址
pitops commentedon May 13, 2020
Thanks @cosoc that worked
faizplus commentedon May 13, 2020
I had same issue and fixed it by updating
"customize-cra": "^1.0.0-alpha.0",
in package.jsonjoyner-perez commentedon May 14, 2020
First: Install yarn add react-app-rewired customize-cra@next
After: In root of your project config-overrides.js, copy and paste next code
`const { override, fixBabelImports, addLessLoader } = require('customize-cra');
module.exports = override(
fixBabelImports('antd', {
libraryDirectory: 'es',
style: true,
}),
addLessLoader({
lessOptions: {
javascriptEnabled: true,
},
}),
);`
rexuli commentedon Jun 3, 2020
For the one who is using 'create-react-app' to customize the theme can check the following settings:
craco.config.js
package.json
artemiste commentedon Jun 3, 2020
thanks @rexuli that work
lesliezsy commentedon Jul 21, 2020
Thank you so much. It works!