-
Notifications
You must be signed in to change notification settings - Fork 12k
Source map not working for SCSS files #9099
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
@clydin any update on this? |
Source map not working for LESS filesI have the same issue with Less files too. The component LESS files appear, but the styles brought in via the CLI are not. Versions
|
Dnia 5 stycznia 2018 04:42 Rukshan Lakshitha Dangalla <[email protected]> napisał(a): Recently I updated cli version 1.3.2 to 1.6.3 and after that I can't see scss source mapped file in developer tools in Chrome of Firefox . Versions : 1.6.3 Angular CLI: 1.6.3Node: 8.9.3OS: win32 x64Angular: 5.0.0... animations, common, compiler, compiler-cli, core, forms... http, platform-browser, platform-browser-dynamic... platform-server, router@angular/cli: 1.6.3@angular/language-service 4.4.6@angular-devkit/build-opt 0.0.36@angular-devkit/core: 0.0.22@angular-devkit/schemati 0.0.42@ngtools/json-schema: 1.1.0@ngtools/webpack: 1.9.3@schematics/angular: 0.1.11@schematics/schematics: 0.0.11typescript: 2.4.2webpack: 3.10.0 Repro steps Create new angular app using ng new sample-app Add scss file in angular-cli.json "styles": ["styles/styles.scss"] Launch app using ng serve -sm -ec Inspect styles using chrome dev-tools. Observed behavior No actual scss file, only style.bundle.css where all the styles compiled. zasobygwp.pl Desired behavior Actual scss file can be seen the developer tools with the line number zasobygwp.pl — You are receiving this because you are subscribed to this thread. Reply to this email directly, zasobygwp.pl view it on GitHub , or zasobygwp.pl mute the thread .
|
I've found that it is actually working for me, but just not for Bootstrap. We're building bootstrap manually and therefore not using the default bootstrap.less found in the LESS folder. |
It does not show references to my project's scss files nor to bootstrap 4's scss files. Only to styles.bundle.css. |
My issues is with Bootstrap 3 and LESS I've got a bootstrap.less (copy from ~/bootstrap/less/bootstrap.less) in my app folder that I've added to the angular-cli.json Which when I run So the fix they mention about removing |
I am not even using
The css is complied and works for all of these, but no source maps. |
@smlombardi Yeah, seems like a bug from at least 1.6.2 onwards |
I've had this problem from 1.5 onwards |
As I can see many folks have this issue. What can we do about this? |
1.6.5 didn't solve the issue for me. (LESS) |
This is making it very hard to work and debug css styling issues. |
Same issue here when I upgraded from 1.4.7 to 1.6.5. Please fix, this is a major blocker! |
Still not working in 1.6.6, FWIW. |
I have same issue, and still wait for fixing. This is a critical issue, it blocks rapid development. |
This is main reason why I am still using Angular 4 and cli 1.4.x in production and not upgrading to Angular 5. |
Some Context:
I remembered it was a weird thing in Webpack config where I had to add extra config to allow sourcemap (in addition to the plugin config). Solution:
Tested with the following Commands in terminal (also works with Sass @import):
|
@chaeusler Not working for me, 1.6.7
|
Proposed solution by @CharltonC works for me on v1.6.3 and v1.6.7 (two test projects I happen to have now). I am using scss @imports for bootstrap and material in styles.scss and I have proper source maps now. Exactly what I need. Thanks CharltonC! |
@chaeusler @dmijatovic Am I missing something? When I add the line recommended, I get the above error, in short This is a standard install of 1.6.7 |
@smlombardi, it looks like your devtool definition is not at right level of configuration. Examine the structure of return {...} @CharltonC provided. The exact line number in the common.js file may vary. I hope this helps. |
@CharltonC thanks for the workaround. Can we expect any kind of fix from the angular team? |
@CharltonC It worked for me. CSS Preprocessor: LESS Version:
|
Sourcemapping for Component-level SCSS FilesCan you confirm, @metasong, @frensuren, @CharltonC, @rukshandangalla, @michael-letcher? Suprisingly, the following solution works without any configuring of Angular 6's angular.json file. Simply add CodeRun
Result in Chrome |
Source mapping for Component-level Can confirm that adding Source mapping for General (Non-component level) I don't need to do this, LESS seems to work by just using |
This is causing an error for me:
|
The sourceURL= solution helps at least tell you the file, but still is far from ideal. It references generated css, so line numbers do not match up and any imported styles will show as belonging to the importing file. @daddyschmack you have a typo, it should be extractCss and not extractsCss, although I was trying this method with a new angular project and its not working with the last couple cli versions. |
I found the source of the issue within the @angular-devkit/build-angular package. You can temporarily fix this yourself editing changing the sourcemap option for both instances of postcss-loader in the following file sourceMap: cssSourceMap to sourceMap: cssSourceMap ? 'inline' : false const rules = baseRules.map(({ test, use }) => ({
exclude: globalStylePaths, test, use: [
{ loader: 'raw-loader' },
{
loader: 'postcss-loader',
options: {
ident: 'embedded',
plugins: postcssPluginCreator,
sourceMap: cssSourceMap ? 'inline' : false
} I'll file an issue with the @angular-devkit/build-angular repository. |
… so they work without this, the way styles are into the DOM breaks the default sourcemap option postcss-loader option docs https://github.com/postcss/postcss-loader#inline fixes angular#9099
…they work without this, the way styles are into the DOM breaks the default sourcemap option postcss-loader option docs https://github.com/postcss/postcss-loader#inline fixes angular#9099
@cedriccjmusic thanks for the example! Sadly isn't working for me with Angular cli 6.1 Versions
Config{
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
....
"stylePreprocessorOptions": {
"includePaths": [
"styles/core-scss"
]
},
"assets": [
....
],
"styles": [
"apps/essent/src/core.scss"
],
"scripts": []
},
"configurations": {
"production": {
....
},
"css": {
"sourceMap": true,
"extractCss": true
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "essent:build",
"port": 4200
},
"configurations": {
"production": {
"browserTarget": "essent:build:production"
},
"css": {
"browserTarget": "essent:build:css"
}
}
}
} CommandsGetting the same result with build & serve yarn ng build essent --source-map --extract-css
yarn ng serve essent --proxy-config proxy.conf.js --configuration css --source-map |
…they work without this, the way styles are loaded into the DOM breaks the default sourcemap option postcss-loader option docs https://github.com/postcss/postcss-loader#inline fixes angular#9099
…they work without this, the way styles are loaded into the DOM breaks the default sourcemap option postcss-loader option docs https://github.com/postcss/postcss-loader#inline fixes angular#9099
…they work without this, the way styles are into the DOM breaks the default sourcemap option postcss-loader option docs https://github.com/postcss/postcss-loader#inline fixes angular#9099
…they work without this, the way styles are into the DOM breaks the default sourcemap option postcss-loader option docs https://github.com/postcss/postcss-loader#inline fixes angular#9099
…they work without this, the way styles are into the DOM breaks the default sourcemap option postcss-loader option docs https://github.com/postcss/postcss-loader#inline fixes angular#9099
…they work without this, the way styles are into the DOM breaks the default sourcemap option postcss-loader option docs https://github.com/postcss/postcss-loader#inline fixes angular#9099
…they work (#11729) without this, the way styles are into the DOM breaks the default sourcemap option postcss-loader option docs https://github.com/postcss/postcss-loader#inline fixes #9099
@ajspera this won't fix angular-cli 1.7.4, am I right? only new 6.x.x? |
@lazysergey Right. You might want to try #issuecomment-392316835 who had a hack working for 1.7.4. I would recommend getting up to 6, though. The next minor patch should have the fix in. |
@ajspera were you able to get smaps to work? Is there somewhere I could read up on how to get them to work properly? I've never actually seen them work in Angular. |
@BenRacicot Hmm, they said it would be in this past patch release but I don't see the commit in branch 6.2.x. It's on master, so it's in the maintainers' hands at this point. If you are desperate, you can make the changes from the commit mentioned above in your installation's source. It's only 2 lines. |
Awesome thanks for replying. |
@metasong's solution is working for Angular 6+ projects |
Any update on this? @metasong's solution doesn't work on component style. |
@camsong It works fine for me in version 7.0.4 |
It's working for me on version 7.0.3. |
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. |
Recently I updated cli version 1.3.2 to 1.6.3 and after that I can't see scss source mapped file in developer tools in Chrome of Firefox .
Versions : 1.6.3
Repro steps
ng new sample-app
"styles": ["styles/styles.scss"]
ng serve -sm -ec
Observed behavior
No actual scss file, only style.bundle.css where all the styles compiled.

Desired behavior
Actual scss file can be seen in the developer tools with the line number

The text was updated successfully, but these errors were encountered: