-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📌📌 Breaking change: css-loader@^3.0.0
(+addLessLoader
)
#253
Comments
I updated to 1.0 and changed included My package-lock.json currently shows I am indeed on 1.0.0:
And inside the node_modules/customize-cra package.json:
Any suggestions? |
@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 |
I ran into the same issue as @mjfwebb after updating
After upgrading my I am using
so i updated |
Just wanted to confirm that my previous experience of it failing was due to my still using less-loader version After upgrading less-loader to the latest version (7.0.1 as of writing this), I was required to add I suggest specifically mentioning this as a caveat or gotcha. |
How can I resolve background-image: url('public/assets/01.png') on the less files? |
Hi @lamdoann, i just gave it a try at put an image at
The background image was loaded correctly in the browser. In dev tools i can see, that the url has been adjusted:
Hope this helps. |
Hi @iwan-uschka, thanks for your reply. |
@lamdoann Can you please share some code? How does your less file look like? How do you reference the image? I guess your image is located in |
Yes, I put images in /public/assets folder. |
Well, like i said, it would help if you can show some code. You haven't said anything yet about how you reference your assets inside your less files. I am using craco to customise
By setting css loader option Maybe you can add some configuration into your
I couldn't find any dedicated documentation about customizing css loader options outside less loader scope. |
Here is my config-overrides.js module.exports = override( And my index.less |
Thx! I guess this doesn't work :) If that's the case we have to wait for others to help out. Sorry.. |
Ah, please have a look again. Yours
is not correct. There is no
|
@iwan-uschka for new version, you can see the first comment of this topic. It will be like this: |
I found the way to fix it. I overrided ModuleScopePlugin plugin. It worked. |
Oooops, i haven't even read the beginning of this block 😬 You're absolutely right about the new version, sorry. |
I've been trying to set up Ant Design with Create React App and Customize CRA but I'm getting an error when loading Less files.
My setup:
When running yarn start, I get the following error: Failed to compile.
./src/entities/scratchpad/theme/antd/custom-theme.less (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-8-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--5-oneOf-8-3!./node_modules/less-loader/dist/cjs.js??ref--5-oneOf-8-4!./src/entities/scratchpad/theme/antd/custom-theme.less)
TypeError: this.getOptions is not a function I have Tailwind installed and running so I guess that de postcss-loader is not the problem. I've read that the problem maybe with less-loader version, but cannot get ant version of it working. Anyone knows why may be this happening and how to solve it? |
Finaly got it working downgrading less loader to version 7. Package.json ConfigOverrides.dev.js config = override(
fixBabelImports('import', {
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
}),
addLessLoader({
lessOptions: {
javascriptEnabled: true,
modifyVars: { '@primary-color': '#13c2c2' },
},
}),
addPostcssPlugins([require('tailwindcss')])
)(config) 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. |
Hi @packetstracer, |
this config is working good too:
package.json
|
As part of our
1.0
release, we need to supportcss-loader@^3.0.0
which was added tocreate-react-app
in #7876.Across various issues (#231, #242, #243), the new
css-loader
configuration format (a switch from a boolean to options forlessOptions
) 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 theircustomizers
configurations.In particular, configuration options for the
addLessLoader
customizer will now be nested in alessOptions
object, as so:Before:
Now:
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 the0.9.1
release until I can diagnose and help you resolve your issue.The text was updated successfully, but these errors were encountered: