css-loader
Advanced tools
Changelog
7.0.0 (2024-04-04)
modules.namedExport
option is true
by default if you enable the esModule
optionMigration guide:
Before:
import style from "./style.css";
console.log(style.myClass);
After:
import * as style from "./style.css";
console.log(style.myClass);
To restore 6.x behavior, please use:
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
namedExport: false,
exportLocalsConvention: 'as-is',
//
// or, if you prefer camelcase style
//
// exportLocalsConvention: 'camel-case-only'
},
},
},
],
},
};
Typescript migration:
Before:
declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}
After:
declare module '*.module.css' {
const classes: { [key: string]: string };
export = classes;
}
modules.exportLocalsConvention
has the value as-is
when the modules.namedExport
option is true
and you don't specify a value5.27.0
18.12.0