unstale

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 init

@unstale/cli on npm

css-loader 711 changes

Breaking changes 4

  • The minimum supported Node.js version is now 18.12.0.

    7.0.0release notes

  • The minimum supported webpack version is now 5.27.0.

    7.0.0release notes

  • Defaults to as-is when modules.namedExport is true and no value is specified.

    7.0.0release notes

  • When esModule is enabled, namedExport defaults to true, so CSS classes are imported as named exports rather than through a default import.

    7.0.0release notes

New APIs and options 1

  • Dashed variants are available for the modules.exportLocalsConvention options.

    7.0.0release notes

Tooling 1

  • Updates the peer dependency to support @rspack/core v2.

    7.1.4release notes

Fixes and other changes 5

  • Strips a BOM before processing with PostCSS, preventing it from interfering with CSS processing.

    7.1.5release notes

  • Uses the official createHash for hashes.

    7.1.3release notes

  • Uses the official hash* options for hashes.

    7.1.3release notes

  • Allows module to be used as a CSS class name.

    7.1.3release notes

  • Works with any modules.exportLocalsConvention values.

    7.0.0release notes

css-loader 618 changes

Breaking changes 11

  • localIdentHashPrefix was removed in favor of localIdentHashSalt.

    6.0.0release notes

  • localIdentHashSalt replaces localIdentHashPrefix.

    6.0.0release notes

  • The [ext] placeholder no longer needs a preceding dot; change .[ext] to [ext].

    6.0.0release notes

  • The [folder] placeholder was removed; use a custom function for complex logic.

    6.0.0release notes

  • The [emoji] placeholder was removed; use a custom function for complex logic.

    6.0.0release notes

  • The modules.compileType option was removed; use modules.mode with the icss value instead.

    6.0.0release notes

  • The modules.mode option replaces modules.compileType and supports the icss value.

    6.0.0release notes

  • The minimum supported Node.js version is 12.13.0.

    6.0.0release notes

  • The url option no longer accepts a Function; use an Object with a filter property instead.

    6.0.0release notes

  • Aliases with a false value now generate an empty data URI (data:0,) when esModules is enabled.

    6.0.0release notes

  • The minimum supported webpack version is 5; the notes recommend updating to the latest version for better performance.

    6.0.0release notes

Deprecations 1

  • Using ~ is deprecated with esModules enabled; package references can omit it because unresolved references are tried in module directories.

    6.0.0release notes

New APIs and options 2

  • Added an option for controlling class hashing.

    6.0.0release notes

  • The modules option can now take the icss string value.

    6.0.0release notes

Performance 1

Behavior and default changes 2

  • Data URIs in url() are handled so loaders can be registered for them.

    6.0.0release notes

  • With esModules enabled, url() uses new URL(...) syntax, allowing CSS to be bundled for libraries.

    6.0.0release notes

Fixes and other changes 1

css-loader 511 changes

Breaking changes 5

  • The exportName value is always unescaped.

    5.0.0release notes

  • The returned value from getLocalIdent is escaped by default.

    5.0.0release notes

  • The previously deprecated icss option was removed.

    5.0.0release notes

  • css-loader migrated to PostCSS 8, so projects using it need to migrate to PostCSS 8.

    5.0.0release notes

  • The runtime no longer includes source map code unless sourceMap is set to true.

    5.0.0release notes

Deprecations 1

Performance 1

Behavior and default changes 1

  • ICSS modules are automatically enabled for files matching /\.icss\.\w+$/i.

    5.0.0release notes

Fixes and other changes 3

  • A fallback is used when a custom getLocalIdent returns null or undefined.

    5.0.0release notes

  • Named exports can now have underscores in their names.

    5.0.0release notes

  • Warnings are no longer emitted when handling url() or @import is not needed.

    5.0.0release notes

css-loader 421 changes

Breaking changes 13

  • Inline requests now require ~ before the file request; rewrite the documented url() syntax accordingly.

    4.0.0release notes

  • The esModule option is now true by default.

    4.0.0release notes

  • The option must always be a Function and must always return a String value.

    4.0.0release notes

  • The icss plugin is disabled by default; configure modules to enable it.

    4.0.0release notes

  • The function arguments are now url, media, and resourcePath, in that order.

    4.0.0release notes

  • localsConvention was moved and renamed to modules.exportLocalsConvention.

    4.0.0release notes

  • onlyLocals was moved and renamed to modules.exportOnlyLocals.

    4.0.0release notes

  • modules.context was renamed to modules.localIdentContext.

    4.0.0release notes

  • modules.hashPrefix was renamed to modules.localIdentHashPrefix.

    4.0.0release notes

  • modules is true by default for files matching the stated .module filename pattern, and module.auto is true by default.

    4.0.0release notes

  • The minimum required Node.js version is now 10.13.0.

    4.0.0release notes

  • The default value of sourceMap now depends on the devtool option.

    4.0.0release notes

  • The minimum required webpack version is now 4.27.0.

    4.0.0release notes

New APIs and options 1

Behavior and default changes 6

  • The file: protocol is now supported.

    4.0.0release notes

  • The default value is compiler.context for the module.getLocalIdent option.

    4.0.0release notes

  • The resolution algorithm no longer requires ~ inside packages in node_modules.

    4.0.0release notes

  • Server relative URLs are now supported.

    4.0.0release notes

  • The url() resolving algorithm was improved.

    4.0.0release notes

  • @value now supports importing url().

    4.0.0release notes

Fixes and other changes 1

  • Resolution now respects the style field from package.json.

    4.0.0release notes

css-loader 322 changes

Breaking changes 17

  • The top-level option was removed in favor of modules.context.

    3.0.0release notes

  • Removed in favor of localsConvention, which accepts a string.

    3.0.0release notes

  • Removed in favor of onlyLocals.

    3.0.0release notes

  • The top-level option was removed in favor of modules.getLocalIdent.

    3.0.0release notes

  • The top-level option was removed in favor of modules.hashPrefix.

    3.0.0release notes

  • Inverts Function behavior: return true when you want to handle @import, and false if not.

    3.0.0release notes

  • The top-level option was removed in favor of modules.localIdentName.

    3.0.0release notes

  • The top-level option was removed in favor of modules.localIdentRegExp.

    3.0.0release notes

  • Replaces exportLocalsStyle and accepts only a string; use camelCase for the former true value and asIs for false.

    3.0.0release notes

  • The context option moves under modules.

    3.0.0release notes

  • The getLocalIdent option moves under modules.

    3.0.0release notes

  • The hashPrefix option moves under modules.

    3.0.0release notes

  • The localIdentName option moves under modules.

    3.0.0release notes

  • The localIdentRegExp option moves under modules.

    3.0.0release notes

  • The minimum required Node.js version is 8.9.0.

    3.0.0release notes

  • Replaces the removed exportOnlyLocals option.

    3.0.0release notes

  • Inverts Function behavior: return true when you want to handle url, and false if not.

    3.0.0release notes

New APIs and options 1

  • The modules option now accepts an object for configuring CSS Modules options.

    3.0.0release notes

Behavior and default changes 1

  • The @value at-rule is now supported in selectors; check existing @value usage because this may affect upgrades.

    3.0.0release notes

Fixes and other changes 3

  • Locals with escaped characters are now exported properly.

    3.0.0release notes

  • Avoids the “from” argument must be of type string error.

    3.0.0release notes

  • Handles non-CSS characters in localIdentName.

    3.0.0release notes

css-loader 220 changes

Breaking changes 4

  • css-loader/locals was dropped in favor of the exportOnlyLocals option.

    2.0.0release notes

  • The new option replaces css-loader/locals for exporting only locals.

    2.0.0release notes

  • CSS modules are disabled by default; set modules to local or global to enable them. global restores the previous behavior.

    2.0.0release notes

  • The release requires postcss@7.

    2.0.0release notes

New APIs and options 2

Performance 3

  • The loader can reuse a PostCSS AST from other loaders such as postcss-loader.

    2.0.0release notes

  • The number of require calls generated for urls() is reduced.

    2.0.0release notes

  • Deduplication of string module IDs is supported.

    2.0.0release notes

Behavior and default changes 5

  • Module resolution is supported in composes.

    2.0.0release notes

  • Disabling the import option affects import at-rules but does not affect composes declarations.

    2.0.0release notes

  • Invalid @import at-rules now emit warnings.

    2.0.0release notes

  • Invalid urls() emit a warning.

    2.0.0release notes

  • Resolution now works the same whether CSS modules are enabled or not.

    2.0.0release notes

Fixes and other changes 6

  • Generated CSS module class names are consistent across operating systems.

    2.0.0release notes

  • Imports with the same media in different cases are no longer duplicated.

    2.0.0release notes

  • Invalid or nonexistent URL or import tokens no longer break the loader.

    2.0.0release notes

  • Broken Unicode characters are fixed.

    2.0.0release notes

  • Uppercase URL is handled in import at-rules.

    2.0.0release notes

  • URLs with ?#hash are processed correctly.

    2.0.0release notes

css-loader 17 changes

Breaking changes 7

  • The alias option was removed; use resolve.alias or postcss-loader with the postcss-url plugin instead.

    1.0.0release notes

  • The camelcase option was removed; use the camelCase option instead.

    1.0.0release notes

  • The minimize option was removed; use postcss-loader with cssnano or optimize-cssnano-plugin instead.

    1.0.0release notes

  • The module option was removed; use the modules option instead.

    1.0.0release notes

  • The minimum required Node.js version is now 6.9.

    1.0.0release notes

  • The root option was removed; use postcss-loader with the postcss-url plugin instead.

    1.0.0release notes

  • The minimum required webpack version is now 4.

    1.0.0release notes