npm / css-loader
css-loader
What changed in css-loader 1 to 7, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
61 breaking2 deprecations7 new APIs and options5 performance15 behavior and defaults1 tooling19 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initcss-loader 711 changes
Breaking changes 4
The minimum supported Node.js version is now 18.12.0.
The minimum supported webpack version is now 5.27.0.
Defaults to as-is when modules.namedExport is true and no value is specified.
When esModule is enabled, namedExport defaults to true, so CSS classes are imported as named exports rather than through a default import.
New APIs and options 1
Dashed variants are available for the modules.exportLocalsConvention options.
Tooling 1
Updates the peer dependency to support @rspack/core v2.
Fixes and other changes 5
Strips a BOM before processing with PostCSS, preventing it from interfering with CSS processing.
Uses the official
createHashfor hashes.Uses the official
hash*options for hashes.Allows
moduleto be used as a CSS class name.Works with any modules.exportLocalsConvention values.
css-loader 618 changes
Breaking changes 11
localIdentHashPrefixwas removed in favor oflocalIdentHashSalt.localIdentHashSaltreplaceslocalIdentHashPrefix.The
[ext]placeholder no longer needs a preceding dot; change.[ext]to[ext].The
[folder]placeholder was removed; use a custom function for complex logic.The
[emoji]placeholder was removed; use a custom function for complex logic.The
modules.compileTypeoption was removed; usemodules.modewith theicssvalue instead.The
modules.modeoption replacesmodules.compileTypeand supports theicssvalue.The minimum supported Node.js version is 12.13.0.
The
urloption no longer accepts a Function; use an Object with afilterproperty instead.Aliases with a
falsevalue now generate an empty data URI (data:0,) whenesModulesis enabled.The minimum supported webpack version is 5; the notes recommend updating to the latest version for better performance.
Deprecations 1
Using
~is deprecated withesModulesenabled; package references can omit it because unresolved references are tried in module directories.
New APIs and options 2
Added an option for controlling class hashing.
The
modulesoption can now take theicssstring value.
Performance 1
The release includes better performance.
Behavior and default changes 2
Data URIs in
url()are handled so loaders can be registered for them.With
esModulesenabled,url()usesnew URL(...)syntax, allowing CSS to be bundled for libraries.
Fixes and other changes 1
Fixed circular
@import.
css-loader 511 changes
Breaking changes 5
The exportName value is always unescaped.
The returned value from getLocalIdent is escaped by default.
The previously deprecated icss option was removed.
css-loader migrated to PostCSS 8, so projects using it need to migrate to PostCSS 8.
The runtime no longer includes source map code unless sourceMap is set to true.
Deprecations 1
The [emoji] placeholder is deprecated.
Performance 1
The runtime was reduced.
Behavior and default changes 1
ICSS modules are automatically enabled for files matching
/\.icss\.\w+$/i.
Fixes and other changes 3
A fallback is used when a custom getLocalIdent returns null or undefined.
Named exports can now have underscores in their names.
Warnings are no longer emitted when handling url() or @import is not needed.
css-loader 421 changes
Breaking changes 13
Inline requests now require ~ before the file request; rewrite the documented url() syntax accordingly.
The esModule option is now true by default.
The option must always be a Function and must always return a String value.
The icss plugin is disabled by default; configure modules to enable it.
The function arguments are now url, media, and resourcePath, in that order.
localsConvention was moved and renamed to modules.exportLocalsConvention.
onlyLocals was moved and renamed to modules.exportOnlyLocals.
modules.context was renamed to modules.localIdentContext.
modules.hashPrefix was renamed to modules.localIdentHashPrefix.
modules is true by default for files matching the stated .module filename pattern, and module.auto is true by default.
The minimum required Node.js version is now 10.13.0.
The default value of sourceMap now depends on the devtool option.
The minimum required webpack version is now 4.27.0.
New APIs and options 1
Locals can now be exported by name.
Behavior and default changes 6
The file: protocol is now supported.
The default value is compiler.context for the module.getLocalIdent option.
The resolution algorithm no longer requires ~ inside packages in node_modules.
Server relative URLs are now supported.
The url() resolving algorithm was improved.
@value now supports importing url().
Fixes and other changes 1
Resolution now respects the style field from package.json.
css-loader 322 changes
Breaking changes 17
The top-level option was removed in favor of modules.context.
Removed in favor of localsConvention, which accepts a string.
Removed in favor of onlyLocals.
The top-level option was removed in favor of modules.getLocalIdent.
The top-level option was removed in favor of modules.hashPrefix.
Inverts Function behavior: return true when you want to handle @import, and false if not.
The top-level option was removed in favor of modules.localIdentName.
The top-level option was removed in favor of modules.localIdentRegExp.
Replaces exportLocalsStyle and accepts only a string; use camelCase for the former true value and asIs for false.
The context option moves under modules.
The getLocalIdent option moves under modules.
The hashPrefix option moves under modules.
The localIdentName option moves under modules.
The localIdentRegExp option moves under modules.
The minimum required Node.js version is 8.9.0.
Replaces the removed exportOnlyLocals option.
Inverts Function behavior: return true when you want to handle url, and false if not.
New APIs and options 1
The modules option now accepts an object for configuring CSS Modules options.
Behavior and default changes 1
The @value at-rule is now supported in selectors; check existing @value usage because this may affect upgrades.
Fixes and other changes 3
Locals with escaped characters are now exported properly.
Avoids the “from” argument must be of type string error.
Handles non-CSS characters in localIdentName.
css-loader 220 changes
Breaking changes 4
css-loader/locals was dropped in favor of the exportOnlyLocals option.
The new option replaces css-loader/locals for exporting only locals.
CSS modules are disabled by default; set modules to local or global to enable them. global restores the previous behavior.
The release requires postcss@7.
New APIs and options 2
Import at-rules can be filtered.
URLs can be filtered.
Performance 3
The loader can reuse a PostCSS AST from other loaders such as postcss-loader.
The number of require calls generated for urls() is reduced.
Deduplication of string module IDs is supported.
Behavior and default changes 5
Module resolution is supported in composes.
Disabling the import option affects import at-rules but does not affect composes declarations.
Invalid @import at-rules now emit warnings.
Invalid urls() emit a warning.
Resolution now works the same whether CSS modules are enabled or not.
Fixes and other changes 6
Generated CSS module class names are consistent across operating systems.
Imports with the same media in different cases are no longer duplicated.
Invalid or nonexistent URL or import tokens no longer break the loader.
Broken Unicode characters are fixed.
Uppercase URL is handled in import at-rules.
URLs with ?#hash are processed correctly.
css-loader 17 changes
Breaking changes 7
The alias option was removed; use resolve.alias or postcss-loader with the postcss-url plugin instead.
The camelcase option was removed; use the camelCase option instead.
The minimize option was removed; use postcss-loader with cssnano or optimize-cssnano-plugin instead.
The module option was removed; use the modules option instead.
The minimum required Node.js version is now 6.9.
The root option was removed; use postcss-loader with the postcss-url plugin instead.
The minimum required webpack version is now 4.