[@next/storybook] - incorrectly imported css throws an inaccurate error
See original GitHub issueBug report
Describe the bug
When a css file is imported in the wrong way, rather than displaying an error that describes the problem, the error can't resolve 'error-loader'
is displayed, with no stack trace.
To Reproduce
- I made this repo for use with duplication
- Add a normal
.css
file and import it within one of the stories (this is not allowed, since normal css imports are only possible in_app.js
) - Observe the incorrect error message
Expected behavior
I would expect that the error message mirror that which you receive when using next.js normally - something along the lines of “global css imports are not allowed within pages, please use a css module or import within _app.js”
System information
- OS: macOS
- Version of Next.js: 9.4.4
- Version of Node.js: 12.13.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
[@next/storybook] - incorrectly imported css throws an ...
When a css file is imported in the wrong way, rather than displaying an error that describes the problem, the error can't resolve...
Read more >Import Global CSS file inside _app.js in next js throws error ...
So, I tried to import some global style in the _app.js component. But when I build the code, I get the following error....
Read more >Solving the React Error: Not Picking Up CSS Style | Pluralsight
In this guide, you will learn about the errors that can occur while importing a CSS file into your React file.
Read more >Features | Vite
The above will throw an error in the browser. Vite will detect such bare module imports in all served source files and perform...
Read more >Customer Engagement – AWS Contact Center - Amazon AWS
Once this contact flow is imported, you can save and publish it making use of ... in event) # Check for any errors...
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
Okay, I have managed to make it work with global CSS by injecting a custom set of rules into that
oneOf
array, so it kinda work without rewriting all the CSS / CSS modules rules. I use the following Storybook config on top of the Next’s SB plugin (note that this is Sass-specific but you can easily make it will work with CSS only):Please verify that your issue can be recreated with
next@canary
.Why was this issue marked with the
please verify canary
label?We noticed the provided reproduction was using an older version of Next.js, instead of
canary
.The canary version of Next.js ships daily and includes all features and fixes that have not been released to the stable version yet. You can think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces by running
npm install next@canary
and test it in your project, using your reproduction steps.If the issue does not reproduce with the
canary
version, then it has already been fixed and this issue can be closed.How can I quickly verify if my issue has been fixed in
canary
?The safest way is to install
next@canary
in your project and test it, but you can also search through closed Next.js issues for duplicates or check the Next.js releases.My issue has been open for a long time, why do I need to verify
canary
now?Next.js does not backport bug fixes to older versions of Next.js. Instead, we are trying to introduce only a minimal amount of breaking changes between major releases.
What happens if I don’t verify against the canary version of Next.js?
An issue with the
please verify canary
that receives no meaningful activity (e.g. new comments that acknowledge verification againstcanary
) will be automatically closed and locked after 30 days.If your issue has not been resolved in that time and it has been closed/locked, please open a new issue, with the required reproduction, using
next@canary
.I did not open this issue, but it is relevant to me, what can I do to help?
Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps. Furthermore, you can upvote the issue using the 👍 reaction on the topmost comment (please do not comment “I have the same issue” without repro steps). Then, we can sort issues by votes to prioritize.
I think my reproduction is good enough, why aren’t you looking into it quicker?
We look into every Next.js issue and constantly monitor open issues for new comments.
However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.
Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.
Useful Resources