NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #1515 most downloaded on npm
css loader module for webpack
Last release 1 months ago
28 Aug 2026
Ships unpredictably
gaps range from 8 days to 1.7 years
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
155 releases · first in 2012
strip BOM before processing with postcss
update peer dependency for @rspack/core v2
One column per quarter.
keep order of @import s with the webpackIgnore comment
automatically rename class default to _default when named export is enabled
added the getJSON option to output CSS modules mapping
The modules.namedExport option is true by default if you enable the esModule option
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);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.018.12.0modules.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.018.12.0add @rspack/core as an optional peer dependency
@rspack/core as an optional peer dependency (#1568) (3924679)resourceQuery and resourceFragment to the auto and mode callback (#1569) (d641c4d)@scope at-rule support6.9.1 (2024-01-18) Bug Fixes css nesting support @scope at-rule support
updated generateExportEntry to expose node details
use cause for original errors and warnings
use template literal when it possible to prevent Maximum call stack size exceeded
output warning when built-in CSS support enabled
remove sourceURL from emitted CSS
css modules generation with inline syntax
### 6.7.1 (2022-03-08) ### Bug Fixes * defaultGetLocalIdent export
## 6.7.0 (2022-03-04) ### Features * re-export defaultGetLocalIdent
## 6.6.0 (2022-02-02) ### Features * added the hashStrategy option
regression with unicode characters in locals
support absolute URL in url() when experiments.buildHttp enabled
generate more collision resistant for locals
added the exportType option with 'array', 'string' and 'css-style-sheet' values
[folder] placeholder (a0dee4f)exportType option with 'array', 'string' and 'css-style-sheet' values (c6d2066)
'array' - the default export is Array with API for style-loader and other'string' - the default export is String you don't need to-string-loader loader anymore'css-style-sheet' - the default export is a constructable stylesheet, you can use import sheet from './styles.css' assert { type: 'css' }; like in a browser, more information you can find heresupports() and layer() functions in @import at-rules (#1377) (bce2c17)@media at-rules (#1377) (bce2c17)allow the exportLocalsConvention option can be a function useful for named export
using ~ is deprecated when the esModules option is enabled (enabled by default) and can be removed from your code (we recommend it) (url(~package/imag…
~ is deprecated when the esModules option is enabled (enabled by default) and can be removed from your code (we recommend it) (url(~package/image.png) -> url(package/image.png), @import url(~package/style.css) -> @import url(package/style.css), composes: import from '~package/one.css'; -> composes: import from 'package/one.css';), but we still support it for historical reasons. Why can you remove it? The loader will first try to resolve @import/url()/etc as relative, if it cannot be resolved, the loader will try to resolve @import/url()/etc inside node_modules or modules directories.file-loader and url-loader are deprecated, please migrate on asset modules, since v6 css-loader is generating new URL(...) syntax, it enables by default built-in assets modules, i.e. type: 'asset' for all url()Node.js version is 12.13.0webpack version is 5, we recommend to update to the latest version for better performanceurl and import options Function type was removed in favor Object type with the filter property, i.e. before { url: () => true }, now { url: { filter: () => true } } and before { import: () => true }, now { import: { filter: () => true } }modules.compileType option was removed in favor the modules.mode option with icss value, also the modules option can have icss string valuenew URL() syntax used for url(), only when the esModules option is enabled (enabled by default), it means you can bundle CSS for librariesurl(), it means you can register loaders for them, examplefalse value for url() now generate empty data URI (i.e. data:0,), only when the esModules option is enabled (enabled by default)[ext] placeholder don't need . (dot) before for the localIdentName option, i.e. please change .[ext] on [ext] (no dot before)[folder] placeholder was removed without replacement for the localIdentName option, please use a custom function if you need complex logic[emoji] placeholder was removed without replacement for the localIdentName option, please use a custom function if you need complex logiclocalIdentHashPrefix was removed in favor the localIdentHashSalt optionresolve.byDependency.css resolve options for @importresolve.byDependency.icss resolve CSS modules and ICSS imports (i.e. composes/etc)modules.localIdentHashFunction, modules.localIdentHashDigest, modules.localIdentHashDigestLength options for better class hashing controlling@import~ is deprecated when the esModule option is enabled (enabled by default) and can be removed from your code (we recommend it) (url(~package/image.png) -> url(package/image.png), @import url(~package/style.css) -> @import url(package/style.css), composes: import from '~package/one.css'; -> composes: import from 'package/one.css';), but we still support it for historical reasons. Why can you remove it? The loader will first try to resolve @import/url()/etc as relative, if it cannot be resolved, the loader will try to resolve @import/url()/etc inside node_modules or modules directories.file-loader and url-loader are deprecated, please migrate on asset modules, since v6 css-loader is generating new URL(...) syntax, it enables by default built-in assets modules, i.e. type: 'asset' for all url()Node.js version is 12.13.0webpack version is 5, we recommend to update to the latest version for better performanceurl and import options Function type was removed in favor Object type with the filter property, i.e. before { url: () => true }, now { url: { filter: () => true } } and before { import: () => true }, now { import: { filter: () => true } }modules.compileType option was removed in favor the modules.mode option with icss value, also the modules option can have icss string valuenew URL() syntax used for url(), only when the esModule option is enabled (enabled by default), it means you can bundle CSS for librariesurl(), it means you can register loaders for them, examplefalse value for url() now generate empty data URI (i.e. data:0,), only when the esModule option is enabled (enabled by default)[ext] placeholder don't need . (dot) before for the localIdentName option, i.e. please change .[ext] on [ext] (no dot before)[folder] placeholder was removed without replacement for the localIdentName option, please use a custom function if you need complex logic[emoji] placeholder was removed without replacement for the localIdentName option, please use a custom function if you need complex logiclocalIdentHashPrefix was removed in favor the localIdentHashSalt optionresolve.byDependency.css resolve options for @importresolve.byDependency.icss resolve CSS modules and ICSS imports (i.e. composes/etc)modules.localIdentHashFunction, modules.localIdentHashDigest, modules.localIdentHashDigestLength options for better class hashing controlling@import.css to resolve.extensions, it reduces performance and in most cases it is simply not necessary, alternative you can set resolve options by dependency[@import](https://github.com/import) (bb76fe4)fix crash when source map is unavailable with external URL in [@import]
always write locals export when css modules/icss enabled
compatibility with named export and es5
do not crash on 'false' aliases
### 5.2.3 (2021-04-19) ### Bug Fixes * improve performance
avoid escape nonASCII characters in local names
do not crash on unescaped svg data uri
support async functions for url and import options
auto option works using inline module syntax (#1274) (1db2f4d)@import with spaces before and after and any extensions (#1272) (0c47cf7)@import and modules (3f49ed0)### 5.1.4 (2021-03-24) ### Bug Fixes * crash with thread-loader
handling @import with spaces before and after and any extensions
crash on modified AST from postcss-loader
added support webpackIgnore comment
pass query with hash to other loaders
sources in source maps have relative paths
[emoji] placeholder was deprecated
sourceMap: truegetLocalIdent escapes by default, the exportName value is always unescaped/\.icss\.\w+$/i is true (the modules.compileType option is icss)[emoji] placeholder was deprecatedicss option was removed (it was deprecated previously)sourceMap: truegetLocalIdent escapes by default, the exportName value is always unescaped/\.icss\.\w+$/i (the modules.compileType option is icss)[emoji] placeholder was deprecatedicss option was removed (it was deprecated previously)the importLoaders option can be string
url function (88b8ddc)compiler.context and use webpack:// protocol (#1169) (fb5c53d)exportOnlyLocals option, now locals are not exported under the locals name, it was big regression, we apologize for that (24c0a12)source maps generation, source from source maps are now relative to compiler.context and use webpack:// protocol
regression with the exportOnlyLocals option, now locals are not exported under the locals name, it was big regression, we apologize for that
add module.type option, the icss option is deprecated
remove unnecessary console call
## 4.1.0 (2020-07-29) ### Features * add icss option (#1140) (a8ec7da) * support absolute paths (f9ba0ce) ### Bug Fixes * do not crash with data URLs
minimum required Node.js version is 10.13.0
Node.js version is 10.13.0webpack version is 4.27.0esModule option is true by defaultsourceMap option depends on the devtool optionicss plugin disable by default, you need to setup the modules option to enable itmodules option is true by default for all files matching /\.module\.\w+$/i.test(filename) regular expression, module.auto is true by defaultmodules.context option was renamed to the modules.localIdentContext optionmodules.localIdentContext value is compiler.context for the module.getLocalIdent optionmodules.hashPrefix option was renamed to the modules.localIdentHashPrefix optionlocalsConvention option was moved and renamed to the modules.exportLocalsConvention optiongetLocalIndent option should be always Function and should always return String valueonlyLocals option was moved and renamed to the modules.exportOnlyLocals optionimport option were changed, it is now funciton(url, media, resourcePath) {}~ before the file request, i.e. rewrite url(~!!loader!package/img.png) to url(!!loader!~package/img.png)@value supports importing url() (#1126) (7f49a0a)url() resolving algorithm (bc19ddd)style field from package.json (#1099) (edf5347)file: protocol (5604205)~ inside packages in node_modules (76f1480)Node.js version is 10.13.0webpack version is 4.27.0esModule option is true by defaultsourceMap option depends on the devtool optionicss plugin disable by default, you need to setup the modules option to enable itmodules option is true by default for all files matching /\.module\.\w+$/i.test(filename) regular expression, module.auto is true by defaultmodules.context option was renamed to the modules.localIdentContext optionmodules.localIdentContext value is compiler.context for the module.getLocalIdent optionmodules.hashPrefix option was renamed to the modules.localIdentHashPrefix optionlocalsConvention option was moved and renamed to the modules.exportLocalsConvention optiongetLocalIndent option should be always Function and should always return String valueonlyLocals option was moved and renamed to the modules.exportOnlyLocals optionimport option were changed, it is now function(url, media, resourcePath) {}~ before the file request, i.e. rewrite url(~!!loader!package/img.png) to url(!!loader!~package/img.png)url() resolving algorithm now handles absolute paths instead of ignoring them. This can break builds which relied on absolute paths to refer to the asset directory. (bc19ddd)@value supports importing url() (#1126) (7f49a0a)url() resolving algorithm to support more path types (bc19ddd)style field from package.json (#1099) (edf5347)file: protocol (5604205)~ inside packages in node_modules (76f1480)allow modules.auto to be a filter function
add file from an error to file dependencies
schema for the modules.auto option
don't generate an invalid code for locals
accept semver compatible postcss AST
modules.auto option, please look at an example of how you can simplify the configuration. (#1067) (c673cf4)modules.exportGlobals option for export global classes and ids (#1069) (519e5f4)modules.mode option may be a function (#1065) (0d8ac3b)modules.auto option, please look at an example of how you can simplify the configuration. (#1067) (c673cf4)modules.exportGlobals option for export global classes and ids (#1069) (519e5f4)modules.mode option may be a function (#1065) (0d8ac3b)do not duplicate css on composes
logic for order and media queries for imports
logic for order and media queries for imports
better handling url functions and an url in @import at-rules
do not crash when an assert return null or undefined
Your coding agent can read these notes before it upgrades. Set up the MCP server →