Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): fix sourcemaps paths
Browse files Browse the repository at this point in the history
`output.devtoolModuleFilenameTemplate` is not used when `SourceMapDevToolPlugin`

https://github.com/webpack/webpack/blob/671cb184e34e748e7c3e1d724ee24263c18c19e9/lib/SourceMapDevToolPlugin.js#L77

Current stacktraces are not properly formatted
```
http://localhost:9876/_karma_webpack_/webpack:/src/app/dummy.component.spec.ts:36:76
```

With this change we wil change this to
```
http://localhost:9876/src/app/validation-directive.ts:13:23
```

This also allows users to click on the stacktrace in the browser and go to source.
  • Loading branch information
alan-agius4 authored and Keen Yee Liau committed Jul 10, 2019
1 parent 32feed1 commit 32e5ff9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export function getSourceMapDevTool(
return new SourceMapDevToolPlugin({
filename: inlineSourceMap ? undefined : '[file].map',
include,
moduleFilenameTemplate: '[namespace]/[resource-path]',
append: hiddenSourceMap ? false : undefined,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ const init: any = (config: any, emitter: any, customFileHandlers: any) => {
// Files need to be served from a custom path for Karma.
webpackConfig.output.path = '/_karma_webpack_/';
webpackConfig.output.publicPath = '/_karma_webpack_/';
webpackConfig.output.devtoolModuleFilenameTemplate = '[namespace]/[resource-path]?[loaders]';

let compiler: any;
try {
Expand Down

0 comments on commit 32e5ff9

Please sign in to comment.