-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
Option for esModule to export named exports instead of default export #1029
Comments
hm, i think we should open issue in webpack, we should concat modules in this case too |
@evilebottnawi Sorry I'm missing a lot of context but am interested in learning. Can you elaborate on your comment? Why should concatenating modules on webpack be necessary? |
@GeorgeTaveras1231 We should improve concatenated module plugin, unfortunately I did not look deep into this problem, so I can not give information where it is better to do. Also |
@GeorgeTaveras1231 I just tried running your example using the same version of webpack (4.41.4) and in my output bundle I actually do see successful tree-shaking: this is with Files I used: https://gist.github.com/jdb8/8049b6952898795be68dd6290e57bdfa I wonder if this has been fixed somewhere, or if I'm missing something? Did you run your original example in production mode with the two |
Implemented on css-loader side, but we should improve it on |
Implemented in |
Expected Behavior / Situation
When the new
esModule
option is enabled, I hoped that each CSS class name would be exported as a named export:Actual Behavior / Situation
Instead, an object of class names to hashes is exported as a default export:
This means that tree-shaking + inlining is very limited. For example, this is able to tree-shake:
But this is not able to tree-shake or inline:
Modification Proposal
If
esModule
used named exports, tree-shaking + inlining would always work as expected.This would significantly reduce bundle size for apps using CSS modules.
The text was updated successfully, but these errors were encountered: