Skip to content

Add a configuration option to map class name to module exports in ES module mode #522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
joseprio opened this issue Apr 4, 2020 · 1 comment

Comments

@joseprio
Copy link

joseprio commented Apr 4, 2020

First of all, thanks for fixing #424!

Feature Proposal

At the moment, a dictionary object is exported in the generated JS module that maps the old classname with the generated one. Unfortunately, this prevents mangling those keys, as it's not guaranteed that they change during runtime (although it's reasonable to assume they won't).
We can solve this by exporting each of those classnames as a module export. Obviously, there's a problem with classnames with hyphens, so I definitely see this as a disabled-by-default configuration flag that would just throw with an informative message if it encounters classnames with dashes in them.

Feature Use Case

Reduces bundle size and memory consumption. A quick experiment showed a reduction of 11Kb in my project.

Happy to work on a PR if this seems useful.

@alexander-akait
Copy link
Member

Duplicate, webpack-contrib/css-loader#1029

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants