-
Notifications
You must be signed in to change notification settings - Fork 12k
stylePreprocessorOptions loads node_modules instead of scss #10535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This also happens if file name is 'colors' |
I can confirm this issue. |
I can as well. Experienced this bug with an existing project after using the new ng update cli command, as well as with a fresh app generated with ng new (CLI version 6.0.3) |
same with 'base' |
I spent all day on this...
... and angular-cli is trying to import some javascript instead of scss. Please help!Angular CLI: 6.0.8 |
Any update from the team on this? @hansl @Brocco @filipesilva |
I got Angular 6 with Foundation 6 working with a variation of your question/answer... Include your stylePreprocessorOptions config, then copy
into your src directory, then edit this line:
to be
In your style.scss you can now do:
I still get a warning I have not worked on yet, but everything compiles. |
Hey @ethanj. The problem of this issue is not exactly the problem @ZbigiMan describes. In fact quite the opposite. The problem is NOT that you cannot add include paths to the stylePreprocessorOptions of the CLI. You can, and it works, as you described. The problem is, that the loader FIRST tries to load from the node_modules directory and THEN tries to load from the included paths. That means, if you have a module called "colors" in node_modules, or a module called "base" you cannot load SCSS files with the same name out of your include paths. These SCSS statements will trigger an error, because the compiler doesn't look in your include paths FIRST but instead tries to load the module in node_modules.
We did not have this behavior in the old version of the CLI and this is why it's breaking existing code. |
Also it tries to import js files, which seems not correct to me, too. |
same issue...
|
I also noticed that it's problem with sass-loader 7. Downgrading to sass-loader 6 solves the issue, so It's not problem with @angular/cli itself but with dependency - sass-loader.
|
Guys if you have the same issue upvote the issue itself. Contributers dont see your +1 comments and dont see your upvotes on the „colors“ thingy. |
Here is link to webpack sass-loader issue webpack-contrib/sass-loader#556 |
If anyone finds this in the short future, until the commits above are merged. I am on:
Downgrading sass-loader in
|
I'm still having this issue in v7. Wasn't it fixed? |
Yea, it looks like it's still there in [email protected] |
Same here when upgrading from v6 to Angular v7. Downgrading sass-loader to |
My workaround was to prefix my style files with my project name abbreviation to avoid naming collusion with libraries inside
will become
Then the import is:
|
Slight digression: For persons trying to use this in multi-app projects, you need to use the full path to the app (project). e.g.
Took me a few minutes to realise this... |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Using
@import 'file'
imports from node_modules when the file is named the same way any node module is named.Angular.json
Existing files
my-component.scss
-> Imports node-module "globals" index.js
my-component.scss
-> Imports node-module "rxjs" index.js
Version
@angular/cli: 6.0.0-rc.7
The text was updated successfully, but these errors were encountered: