[experimental css] Getting error when importing global css inside _app
See original GitHub issueBug report
Describe the bug
I wanted to test experimental css implementation. Once I enabled it I got build error saying
Global CSS cannot be imported from files other than your Custom <App>. Please move all global CSS imports to src/pages/_app.tsx.
Only global peace of css (in fact only .css import in my app) is indeed defined inside _app.tsx
import 'normalize.css/normalize.css';
Hence I am not sure what this error means. Error trace doesn’t seem to point to any specific file either.
Only reason I can think of is if some other node_module is importing css internally?
System information
- OS: macOS 10.15.2
- Version of Next.js: 9.1.6
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Next.js Global CSS cannot be imported from files other than ...
So you have a global css that must be included on every single page, it has to be imported into the app file...
Read more >Next.js: Global CSS cannot be imported from files other than ...
I would get the following error: Error. Global CSS cannot be imported from files other than your Custom <App\> . Please move all...
Read more >[@next/storybook] - incorrectly imported css throws ... - GitHub
When a css file is imported in the wrong way, rather than displaying an error ... Please move all global CSS imports to...
Read more >import - CSS: Cascading Style Sheets - MDN Web Docs
The @import CSS at-rule is used to import style rules from other valid stylesheets. An @import rule must be defined at the top...
Read more >Styles & CSS - Astro Documentation
A common pattern in Astro is to import global CSS inside a Layout component. Be sure to import the Layout component before other...
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

I also just realized that we don’t tell you the file that’s importing the CSS file 🤕.
Opened a PR to fix that: #9850 (so you don’t have to guess)
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.