-
Notifications
You must be signed in to change notification settings - Fork 12k
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
SCSS SourceMap pointing to the Parent selector only. #2826
Comments
+1 on this issue.Hey @geoff-gedde, some of us are having this same issue in Stack Overflow, see: Except I don't even get a |
The code is still inline, but because the source-map is running it will point to the source of the inline css which is styles.scss. |
Looks like this issue is more related to Webpack then angular-cli as it also happens on vuejs 2.0 with webpack. This also may be related to using the style loader instead of loading the file. I will be testing some more. |
Not sure why this was closed. Using static files is not a fix, but a work-around. I tried using "extract-text-webpack-plugin" instead of 'style-loader' to make the css an external file which works great to make the css files separate so they are cached, but the source map is still not pointing to the correct selector. So it is not related to 'style-loader'. This makes me think that the issue is related to sass-loader. Yes, I will file an issue with sass-loader though. |
Posted on sass-loader here: |
@ggedde the PR that closed this issue (#2646), added, among other things, sourcemap support to the CSS pipeline (https://github.com/angular/angular-cli/pull/2646/files#diff-d85c71bf928fadd8cda87cb456e03d30R8). I believe that has fixed this issue. The change isn't released yet, it should be out in the next release. If this isn't fixed then I'm happy to reopen and investigate more. |
Updates: I have managed to have sourcemaps in beta 20-4 The codebase is still failing in devel but removing style-loader, from the cssLoader array and adding ExtractTextPlugin.extract to loaders, solve the problem: Also seems beta 20.4 solved the misspointing line. |
Fix angular#2148 Fix angular#2020 Fix angular#2826 Close angular#2646
@ggedde were you able to get this to work for you ? |
Sorry @nadhir-falta, I took a pause from this project. I am still getting this issue. jhnns from sass-loader has confirmed that it is happening on sass-loader. So I am not sure where the issue is exactly coming from and not sure what I can do to help out. |
When you type ng serve by default angular cli doesn't include sourcemaps files for css files but you can include it by typing this command
or
I use Angular Cli -v 1.0.3, and More information - Angular CLI special cases |
Yes @Koziuk-S I have been using both those tags. |
I did find a partial solution. @filipesilva I think a quick solution for Chrome would be to add Thanks |
@ggedde is the repro you posted originally still valid for the issue you're still experiencing? Reading through webpack-contrib/sass-loader#272 (comment) it seems like your fix will break sourcemaps in firefox, so I don't think that's a good solution. postcss/postcss#926 (comment) indicates that this problem will be fixed at some point though. |
@filipesilva Firefox's bug is not related to sass-loader. It is just related to how node-sass compiles the sourcemap. So I think making the change to the sass-loader [options] in node_modules/@angular/cli/models/webpack-configs/styles.js is still valid. Thanks |
ng serve --sourcemap --extractCss This info should be published somewhere if it is not. |
Closing this as sourcemap support has been greatly improved in 6.x and further in the upcoming 7.0 (currently in release candidate). If problems are still occurring with the latest versions, please open a new issue detailing the version and environment information. Thank you. |
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. |
Mac OSX (El Capitan?)
angular-cli: 1.0.0-beta.18
node: 6.7.0
When running 'ng serve' or 'ng build' the SCSS SourceMaps only point to the Parent selector and not the correct selector.
But as you can see it is not pointing to the correct selector. It should be pointing to line 13 not line 5.
This seems to be related more towards angular-cli and webpack as running the node-sass cli works fine and points to line 13
node-sass --source-map true src/styles.scss > styles.css
I have tried changing devtool to 'source-map' in
/node_modules/angular-cli/models/webpack-build-development.js
And still no luck.
PS in order to get SourceMaps to work I needed to add ?sourceMap to the css and sass loaders in
/node_modules/angular-cli/models/webpack-build-common.js
Also I needed to update angular-cli: 1.0.0-beta.17 to angular-cli: 1.0.0-beta.18
Here is my loader configurations in
/node_modules/angular-cli/models/webpack-build-common.js
I tried removing 'postcss-loader' and also rearranging the loaders, but still no luck.
I am thinking that maybe one of the loaders is running before the sass source-maps is running and getting the incorrect or compressing the css before it runs the source map, but I am not sure.
Any Help?
Thanks
The text was updated successfully, but these errors were encountered: