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.

CSS Modules cannot be imported from within node_modules when not using a node_modules export

See original GitHub issue

What version of Next.js are you using?

11.1.2

What version of Node.js are you using?

16.6.0

What browser are you using?

Firefox

What operating system are you using?

Windws

How are you deploying your application?

next start

Describe the Bug

error - ./styles/Album.module.scss CSS Modules cannot be imported from within node_modules.

This error appears without explicitely importing from node_modules. Only imports used are `@import ‘bootstrap/scss/_functions.scss’; @import ‘bootstrap/scss/_variables.scss’; @import ‘bootstrap/scss/_mixins.scss’;

@import “./Variables.scss”;`

Expected Behavior

No error

To Reproduce

No clear steps to reproduce

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jorgev259commented, Oct 4, 2021

https://github.com/jorgev259/bug-test Repo where i managed to replicate the bug

0reactions
balazsorban44commented, Jan 27, 2022

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[9.3] CSS Modules cannot be imported from within ... - GitHub
I'm trying to properly migrate to Next 9.3 and use the built-in sass feature. When I have a file named *.module.scss (not even...
Read more >
CSS Modules cannot be imported from within node_modules
There's a workaround. You can use next-css. It seems to be a duplicate of https://stackoverflow.com/a/55255918/19135131. Does it help you?
Read more >
Features | Vite
In this case, the processed CSS string is returned as the module's default export as usual, but the styles aren't injected to the...
Read more >
css modules cannot be imported from within node_modules
When I have a file named *.module.scss (not even imported), I have warnings in the terminal saying that CSS Modules cannot be imported...
Read more >
Basic Features: Built-in CSS Support - Next.js
Next.js supports including CSS files as Global CSS or CSS Modules, using ... importing a CSS file from node_modules is permitted anywhere in...
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