question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Component-level CSS doesn't work

See original GitHub issue

Bug 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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
creativiiicommented, Apr 1, 2020

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!

1reaction
jamesmosiercommented, Apr 1, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found