Component-level CSS doesn't work
See original GitHub issueBug report
Describe the bug
[name].module.css import doesn’t work. Either the explanation here is missing a critical explanation to make them work or it’s broken.
To Reproduce
I’ve created a codesandbox illustrating the problem. Strangely enough here it gives an error, on my live app styles
is just an empty Object.
Expected behavior
styles
should contain styles to use in my code.
System information
- OS: Any
- Version of Next.js: 9.3.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Component-level CSS doesn't work · Issue #11549 - GitHub
I've created a codesandbox illustrating the problem. Strangely enough here it gives an error, on my live app styles is just an empty...
Read more >Storybook Component-level css file not working - Stack Overflow
In order to storybook works with webpack , you have to firstly create file main.js under the .storybook dir.
Read more >Basic Features: Built-in CSS Support - Next.js
Adding Component-Level CSS Next.js supports CSS Modules using the [name].module.css file naming convention. CSS Modules locally scope CSS by automatically ...
Read more >CSS in Components | Lightning Aura ... - Salesforce Developers
All top-level elements in a component have a special THIS CSS class added to them. This, effectively, adds namespacing to CSS and helps...
Read more >Styling - Remix
Remix also supports "runtime" frameworks like styled components where styles are ... how and when to load CSS, so it was usually all...
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 FreeTop 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
Top GitHub Comments
That was my bad, it seems I had forgotten to remove references to
"@zeit/next-css"
when I upgraded to a much newer version of Next.Thank you for your help!
Nope, the name shouldn’t matter, as long as you are importing the correct name of the CSS file.
This example works for me locally: https://github.com/jamesmosier/next-css-module-example