CSS modules don't seem to work when using bundle:true #3623
Unanswered
vivianeasley
asked this question in
Troubleshooting
Replies: 1 comment 1 reply
-
hi @robertpage, snowpack uses esbuild to bundle files and there is a open issue at esbuild for bundling css modules. so unless esbuild supports bundling of css modules, snowpack wont be able to support it when bundle : true. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thanks in advance for looking at this! It's been driving me a bit nuts. I'm using css modules as defined in the docs:
import styles from './style.module.css';
<div className={styles.app}>
This works great in DEV and even the build until I set bundle to true. Then all the class names are "undefined undefined" because the object that holds the mapped class name is empty:
Zr={}
H.createElement("div",{className:Zr.app}
Whats weird is that when I change the css file extension to .scss (I'm not actually using SASS) the classnames are in the object but then my compiled CSS file doesn't have the CSS in it. So it's a one or the other scenario. I added some console.logs to the snowpack build code and it looks like it's loading the .css files. Is there some setting not in the docs to handle CSS modules? Am I missing something really obvious? Thanks!!!
Beta Was this translation helpful? Give feedback.
All reactions