Skip to content

Instantly share code, notes, and snippets.

@angel-vladov
Created September 27, 2018 20:33
Show Gist options
  • Save angel-vladov/83327fb21dd5c618cade5685d0f612bd to your computer and use it in GitHub Desktop.
Save angel-vladov/83327fb21dd5c618cade5685d0f612bd to your computer and use it in GitHub Desktop.
Working Angular 6 SCSS Sourcemaps
--- node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/styles.js
+++ node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/styles.js
@@ -220,7 +220,7 @@ function getStylesConfig(wco) {
options: {
ident: 'embedded',
plugins: postcssPluginCreator,
- sourceMap: cssSourceMap
+ sourceMap: cssSourceMap ? 'inline' : false
}
},
...use
const fs = require('fs');
const sh = require('shelljs');
const PATCH_LOCK = 'node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/.patched-enable-sourcemaps';
// You can generate patch file by `git diff` or use `diff -Nur`
if (!fs.existsSync(PATCH_LOCK)) {
sh.exec('patch -p0 -i tools/cli-patches/enable-sourcemaps.patch');
sh.touch(PATCH_LOCK);
}
@angel-vladov
Copy link
Author

angel-vladov commented Sep 27, 2018

Usage instructions here

WARNING:

The patch might break with any future version of @angular-devkit. If this happens you’ll need to generate another patch file using git diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment