addLessLoader issue when using less-loader
See original GitHub issueI’m using react-app-rewired and I’ve recently updated less-loader to the new version (6.0.0). My customize-cra version is 0.9.1.
I’m getting the following error when I run react-app-rewired build:
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 ‘source’. These properties are valid: object { lessOptions?, prependData?, appendData?, sourceMap? }
I’ve the config-overrides.js file like this:
const { override, fixBabelImports, addLessLoader } = require("customize-cra");
module.exports = override(
fixBabelImports("import", {
libraryName: "antd",
libraryDirectory: "es",
style: true
}),
addLessLoader({
lessOptions: {
javascriptEnabled: true,
modifyVars: {
"@primary-color": "#030852", // primary color for all components
}
}
})
);
I added the lessOptions object but it didn’t solve the problem. Could you tell me which is the proper way to set addLessLoader options?
Thanks in advance,
Issue Analytics
- State:
- Created 3 years ago
- Reactions:17
- Comments:23
Top Results From Across the Web
less-loader | webpack - JS.ORG
There is a known problem with Less and CSS modules regarding relative file paths in url(...) statements. See this issue for an explanation....
Read more >less files not getting picked up by less-loader - Stack Overflow
I am using customize-cra with react-app-rewired to add a loader for less files. config-overrides.js file const { override, addLessLoader } = ...
Read more >How to use the customize-cra.addLessLoader function ... - Snyk
How to use the customize-cra.addLessLoader function in customize-cra. To help you get started, we've selected a few customize-cra examples, based on popular ...
Read more >customize-cra-less-loader - npm
Add less loader to any create-react-app using customize-cra. Latest version: 2.0.0, last published: a year ago.
Read more >less-loader - webpack
The blog post is about Sass but it also works for Less. CSS modules gotcha. There is a known problem with Less and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I solved fix by installing customize-cra-less-loader
package.json:
config-override.js:
same problem !!! I‘ve rolled back the less and less-loader edit to 2.73 , 4.10. Then the problem resolved. but, it’s really not a good ideal.