(Next.js) Global CSS cannot be imported from within node_modules.
See original GitHub issueI really enjoy the package, but it is not possible to be used with Next.js.
Description
When importing the package I receive following error message.
error - ./node_modules/rc-slider/assets/index.css
Global CSS cannot be imported from within node_modules.
Read more: https://err.sh/next.js/css-npm
Location: node_modules/react-jinke-music-player/es/index.js
It is quite discussed problem of Next.js. Is there any workaround with react-music-player
?
Some more info can be found on Next.js Github dedicated to this error.
Version
Using package version 4.16.5 with Next.js 9.5.1.
Thank you!
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Global CSS cannot be imported from within node_modules.
Try to import a CSS from a 3rd party lib. Expected behavior. To be able to import css. System information. OS: macOS; Chrome;...
Read more >Next.js Global CSS cannot be imported from files other than ...
Since Next.js 9.2 global CSS must be imported in Custom <App> component. // pages/_app.js import '../global-styles/main.scss' export default ...
Read more >Next.js: Global CSS cannot be imported from files other than ...
When migrating to Next.js 9+, I was running into an issue where I could not import global styles from any file other than...
Read more >css-global | Next.js
An attempt to import Global CSS from a file other than pages/_app.js was made. Global CSS cannot be used in files other than...
Read more >Global CSS cannot be imported from within node_modules
Global CSS cannot be imported from within node_modules. 2022.03.21 ... Read more: https://nextjs.org/docs/messages/css-npm Location: ...
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
@emulienfou Your are right, in
4.17.1
version, I have already move 2 css files from index.js to index.less. you can try it 🥇Hi @lijinke666 trying to use your package, however having the same issue with Next.js.
Is it possible for you to make some changes and load the 2 CSS files directly from your local less files instead of the
index.js
file of your package?This will assure a compatibility with Next.js and also not using an outdated fork.