importing scss from node_modules causes build to fail
See original GitHub issueBug
Importing a scss (eg, bootstrap) fails with error
Rendering routes error: Error: File to import not found or unreadable: ~bootstrap/scss/bootstrap.
This happens when import is done in lazy loaded component. How to reproduce:
- add
@import "~bootstrap/scss/bootstrap";
at the top ofpages/UserInfo/styles.scss
- directly navigate to
http://localhost:3000/UserInfo/1
or refresh page. It’ll show “Not Found 😦” and above error in console.
Seems to work if imported to top level component or index route component.
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
SCSS imports fail · Issue #6058 - GitHub
Import modules in your scss; run node_modules/.bin/webpack-dev-server; See error ... ERROR in [removed] Module build failed (from .
Read more >Importing SCSS from a Node Module causes Webpack Errors
I have an Angular 7 app, built using a starter kit called ASPNet Core Angular Universal, and I would like to use SCSS...
Read more >Sass: @import
The @import rule has a number of serious issues: @import makes all variables, mixins, and functions globally accessible. This makes it very difficult...
Read more >sass-loader - webpack - JS.ORG
The sass-loader uses Sass's custom importer feature to pass all queries to the Webpack resolving engine. Thus you can import your Sass modules...
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 >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
Yeah importing like so
@import 'node_modules/bootstrap/scss/bootstrap';
works.@amitava82 how about removing
~
character. In my project, I just use like below and it worksimport '@package/folder_name/dist/ace.css';