You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 28, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 28, 2026. It is now read-only.
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When a class name within a css file is shared using "composes" in a 2 degree level, it gets duplicated (when each class has its own file).
For example (each class has its own css file):
Case 1 (composes in 1 degree level)
"primary-button" which composes "button" and;
"secondary-button" which composes "button".
This case is ok, and nothing gets duplicated.
Case 2 (composes in 2 degree level)
"next-button" which composes "primary-button" which composes "button" and;
"back-button" which composes "secondary-button" which composes "button".
On this case, the "button" class gets duplicated.
To test with style-loader, execute "npm run start1"
To test with mini-css-extract-plugin, execute "npm run start2"
What is the expected behavior?
It shouldn't duplicate css class.
Please mention other relevant information such as your webpack version, Node.js version and Operating System.
Node.js: v8.11.3
Webpack: v4.19.1
Operating System: Windows 10
Thanks in advance.
Best Regards,
Ivens Gonçalves.
Reacted by vladzdev, Linus Miller, Denys Kniazevych and Eugene Datsky
For traceability: this issue didn't just effect usage of optimization.namedModules but also HashedModuleIdsPlugin (which is a recommended plugin for long term caching in production).
Activity
webschik commentedon Nov 5, 2018
I have the same issue,
webpack 4.23.1
css-loader 1.0.1
Node 10.3.0
macOS
princed commentedon Nov 16, 2018
There is a fix now in #789
The workaround is to disable
namedModules, i.e. add the following to the webpack config:@ivensgoncalves Thank you for the complete test case! 👍
ivensgoncalves commentedon Nov 26, 2018
@princed The workaround worked fine. Thank you very much!
OliverJAsh commentedon Feb 12, 2019
For traceability: this issue didn't just effect usage of
optimization.namedModulesbut alsoHashedModuleIdsPlugin(which is a recommended plugin for long term caching in production).vladzdev commentedon Jan 6, 2020
There is regression with the latest css-loader. The issue present again.