customize-cra: ๐๐ Breaking change: `css-loader@^3.0.0` (+`addLessLoader`)
As part of our 1.0
release, we need to support css-loader@^3.0.0
which was added to create-react-app
in #7876.
Across various issues (#231, #242, #243), the new css-loader
configuration format (a switch from a boolean to options for lessOptions
) has caused errors during the run and build process of customize-cra.
With version 1.0
, we have introduced a fix for this, although it is a breaking change, and will require maintainers to alter their customizers
configurations.
In particular, configuration options for the addLessLoader
customizer will now be nested in a lessOptions
object, as so:
Before:
addLessLoader({
javascriptEnabled: true,
modifyVars: { '@primary-color': '#A80000' },
}),
Now:
addLessLoader({
lessOptions: {
javascriptEnabled: true,
modifyVars: { '@primary-color': '#A80000' },
},
}),
For additional information, please see the revised docs.
If you run into issues migrating to the 1.0
release, please report the issue, and fall-back to the 0.9.1
release until I can diagnose and help you resolve your issue.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 13
- Comments: 20
Finaly got it working downgrading less loader to version 7.
Package.json
"less-loader": "^7.1.1"
ConfigOverrides.dev.js
NOTE: that for Tailwind to load correctly I had to set the addPostcssPlugins([require(โtailwindcssโ)]) invocation line after the addLessLoader() one.
Hope this helps to anyone.
this config is working good too:
package.json
Just wanted to confirm that my previous experience of it failing was due to my still using less-loader version
5.0.0
, just as @iwan-uschka described.After upgrading less-loader to the latest version (7.0.1 as of writing this), I was required to add
lessOptions: {
as originally posted.I suggest specifically mentioning this as a caveat or gotcha.
@mjfwebb Thanks for reporting thisโthat is odd, but I will take a look at it tonight and get back to you.
Please use without the nested
lessOptions
for the time being so that you can continue to use your .less files.I updated to 1.0 and changed included
lessOptions: {
as advised. This caused all .less files to stop loading. I removed the nestedlessOptions: {
object and it works fine.My package-lock.json currently shows I am indeed on 1.0.0:
And inside the node_modules/customize-cra package.json:
Any suggestions?