Unable to use CSS Modules example from the website
See original GitHub issue🐛 bug report
Basic example from the website appeared to be not working: CSS Modules can’t be used since no class names were exported.
🎛 Configuration (.babelrc, package.json, cli command)
No configuration. I installed Parcel using Yarn globally and used parcel index.html.
🤔 Expected Behavior
CSS class name available in JS.
😯 Current Behavior
classes.main from the snippet on the website is undefined.
💻 Code Sample
Files index.html, index.js, main.js, and main.css from https://parceljs.org/.
🌍 Your Environment
| Software | Version(s) |
|---|---|
| Parcel | 1.6.1 |
| Node | 8.9.4 |
| Yarn | 1.3.2 |
| NVM | 0.27.1 |
| Operating System | macOS Sierra |
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Unable to use css module in create-react-app - Stack Overflow
CSS Loader has been initialized using an options object that does not match the API schema. - options has an unknown property 'localIdentName'....
Read more >Using CSS Module Scripts to import stylesheets - web.dev
Learn how to use CSS module scripts to import CSS stylesheets using the same syntax as JavaScript modules.
Read more >How to configure CSS Modules for webpack - LogRocket Blog
Increase the flexibility of your app's CSS components with CSS Modules and Webpack in this handy tutorial and demo app build.
Read more >How to configure CSS and CSS modules in webpack
One of the first thing you need to configure in your webpack project is CSS. CSS is so fundamental to a web app...
Read more >Solving the React Error: Not Picking Up CSS Style | Pluralsight
Here, the CSS file is saved outside the src folder, so the compiler failed to import it. To make this code work, you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@alexeyraspopov I don’t think there are any plans to enable postcss modules by default because that would probably get in the way of people who don’t want any postcss in their projects. But it should be pretty simple now that all you have to do is add a .postcssrc
We probably should make the docs more clear, since your not the first person to run into this issue where you don’t realize you need to make a .postcssrc
Parcel just works… unless you try to use something as basic as CSS