I'm using next-css like this:
module.exports = withCss({
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
localIdentName: "[local]___[hash:base64:5]",
},
webpack (config) { ...
I want to add an exception for rc-slider loading with css-modules. but I dont know how to do it.
any help?
I have the same requirement.
In my situation, i just want all the .css files not to be compiled with css modules and i can not find a official solution to do it so I treated it in a brute way
module.exports = withImages(withCSS(withLess({
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
localIdentName: "[local]___[hash:base64:5]",
},
webpack (config) {
config.module.rules.forEach(rule => {
if (String(rule.test) === String(/\.css$/)) {
rule.use.forEach(u => {
if (u.options) {
u.options.modules = false;
}
})
}
});
return config;
}
})));
@WeiGrand thank you very much!
Now if you use Next.js 9.2 and higher you don't need to use next-css for enabling CSS Module.
https://nextjs.org/blog/next-9-2
Hi, thanks for creating an issue. We currently recommend using https://nextjs.org/docs/basic-features/built-in-css-support as the plugins have been deprecated in favor of the built-in support.
Yep, that's what i meant
Most helpful comment
I have the same requirement.
In my situation, i just want all the
.cssfiles not to be compiled with css modules and i can not find a official solution to do it so I treated it in a brute way