-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
CSS Modules classes get removed in production build even when used #5986
Comments
Looks like @parcel/packager-css is failing to get usedSymbols. let usedSymbols = bundleGraph.getUsedSymbols(asset);
console.log({usedSymbols}); // always returns `{usedSymbols: Set(0) {}}` |
For me, this only happens with Related: #5728 |
Impossible to test without the flag because of #5985 |
(A workaround would be |
Unfortunately, the workaround doesn't work when |
This happens with any modular style, same happens with sass modules when Also even when only the target module file is being compiled; the following will also result in an empty CSS bundle: |
This is by no means a solution but I found a temporary workaround when you need to build with
Whereas this ones will:
|
Although this is a weird issue, the solution from @MalgoBlock works as temporary fix. |
I can confirm I encountered this issue today on a project with CSS modules enabled, when updating from Parcel beta2 to Parcel RC. Wrapping with html like @MalgoBlock seems to work as a temp fix. |
The same problem occurs even when I run parcel build with
--no-cache --no-scope-hoist --no-optimize
package.json
.babelrc
🤔 Expected Behavior
All styles are preserved in production build.
😯 Current Behavior
Styles in the built CSS file:
(notice how most of the styles are missing)
💻 Code Sample
Example file:
Component:
🌍 Your Environment
The text was updated successfully, but these errors were encountered: