npm / postcss-modules
postcss-modules
What changed in postcss-modules 7 to 9, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-19.
2 breaking7 new APIs and options1 behavior and defaults3 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initpostcss-modules 97 changes
Breaking changes 1
The minimum Node.js version is now 20.6, the release that stabilized module.register.
New APIs and options 5
Run Node with the loader imported to enable CSS imports that return the class-name token map.
Loader options can also be supplied under a postcss-modules key in package.json, using the same shape as the PostCSS plugin.
The environment variable is an additional location for loader options.
Adds an opt-in Node module-customization hook that lets JavaScript import CSS and receive its class-name token map as the default export.
Loader options can be configured in this file in the current working directory, using the same shape as the PostCSS plugin.
Fixes and other changes 1
Added a type declaration so TypeScript users can extend the loader with declare module without hitting a type error.
postcss-modules 85 changes
New APIs and options 2
The new 'all' value emits the original class name plus camelCase and dashes-camelCase variants in one pass.
The new 'none' value emits only the original class name, with no additional aliases.
Behavior and default changes 1
The function form may return an array of strings; each entry is added to the locals map and resolves to the same value, enabling multiple JS-friendly aliases for one CSS class.
Fixes and other changes 2
Empty rules left behind after :global unwrapping are removed instead of emitted as orphaned
{ ... }blocks.hashPrefix is now applied when no custom generateScopedName is set, fixing the built-in default generator silently ignoring the option.
postcss-modules 71 changes
Breaking changes 1
Support for Node.js 10, 12, 14, and 15 was dropped; the minimum supported version is now 18.