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
[BUG] [3.1.2] CSS modules support is broken when optimize.bundle is true #2998
Comments
@fgblomqvist did you find a solution? |
If you're using the default esbuild, maybe it is because of this? evanw/esbuild#20 (comment) |
Thanks for filing. I recently pushed a fix for CSS Modules in |
@drwpow Could this PR affect SCSS modules loaded with |
I have the same issue as OP with snowpack 3.3.3 |
Thanks for reporting. Will take a look later today. In the meantime please use 3.3.2 |
I can confirm that 3.3.3 did indeed break CSS modules (I'm also using sass, like @andreibsk). 😕 |
@andreibsk @sloonz @fgblomqvist thanks for raising. I’ve made a PR here to fix the core support with Snowpack + CSS Modules: #3186. This should fix the issue, and improve CSS Module output beyond what 3.3.2 and older offered. However, I am seeing an issue with esbuild—it seems to be stripping the CSS Module names from the final build when |
@drwpow Didn't look at the code yet, but the second issue you're talking about sounds like the one I opened this issue for 😄 . Appreciate the fix! |
Sorry—didn’t mean to close the issue. After more investigating, it seems like we are passing just a plain Edit: supporting CSS Modules in esbuild will be tricker than additionally anticipated. Currently investigating a workaround, but as @fgblomqvist suggested in #3187 perhaps |
FYI CSS modules are also broken when using It is broken in Combo 1
Combo 2
I have a suspicion that this might be due to an incomplete fix in #3219. |
Bug Report Quick Checklist
Describe the bug
Module imports (e.g.
import styles from './App.module.css'
) get turned into something like:All of the module files get merged into the single
index.css
, together with all the non-module CSS. No module-specific actions (like compiling the classnames) get done.To Reproduce
npx create-snowpack-app new-dir --template @snowpack/app-template-react-typescript
echo ".foo { width: 100%; }" > src/test.module.scss
import styles from './test.module.scss'
to theApp.tsx
file.className={styles.foo}
on one of the elements).bundle: true
in the snowpack config.npm run build
Expected behavior
I'd probably expect the CSS module classes to get compiled and then, perhaps, combined with the other CSS. Finally, the import should be something like
var _default = {foo: 'foo_8dj23j9k2'}
to link the names.The text was updated successfully, but these errors were encountered: