-
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
Incompatible with Create-React-App 5.0: Invalid Options for PostCSS Loader #315
Comments
Hi, I also encountered this problem. |
I've wrote lessLoader_forCRA5 https://gist.github.com/casamia918/43b1d513de8fb36b364b403bda0034da Use this one, rather than lessLoader from customize-cra@1.0.0 |
You can add the following code to the configuration. // config-overrides.js
config.module.rules.forEach(item => {
if (item.oneOf) {
item.oneOf.forEach(item => {
item.use?.forEach(item => {
if (
item.loader?.includes('postcss-loader') &&
!item?.options?.postcssOptions
) {
const postcssOptions = item.options;
item.options = { postcssOptions };
}
});
});
}
}) |
There is a workaround with
Remember to put |
This method solves the problem, but the project starts with a lot of warnings and css reference errors. It does not affect the normal development of the project though. |
You could write it like this module.exports = {
webpack: override(
addWebpackModuleRule({
test: [/\.css$/, /\.less$/],
use: ['style-loader', 'css-loader', 'postcss-loader', { loader: 'less-loader' }]
})
)
} |
nice ways, solved my problem. |
amazing!!! works like a charm! 🥳 🥳 🥳 🥳 🥳 |
There wil be a critical error when using
addLessLoader
.The text was updated successfully, but these errors were encountered: