Skip to content

Commit

Permalink
fix(@angular/cli): correct sourcemap source paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Lyding authored and Brocco committed Jun 15, 2017
1 parent ca9414b commit bd0dac1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/@angular/cli/models/webpack-configs/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,16 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
extraPlugins.push(new ProgressPlugin({ profile: buildOptions.verbose, colors: true }));
}

if (buildOptions.sourcemaps) {
extraPlugins.push(new webpack.SourceMapDevToolPlugin({
filename: '[file].map[query]',
moduleFilenameTemplate: '[resource-path]',
fallbackModuleFilenameTemplate: '[resource-path]?[hash]',
sourceRoot: 'webpack:///'
}));
}

return {
devtool: buildOptions.sourcemaps ? 'source-map' : false,
resolve: {
extensions: ['.ts', '.js'],
modules: ['node_modules', nodeModules],
Expand Down
3 changes: 3 additions & 0 deletions packages/@angular/cli/tasks/eject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ class JsonWebpackSerializer {
case (<any>webpack).HashedModuleIdsPlugin:
this._addImport('webpack', 'HashedModuleIdsPlugin');
break;
case webpack.SourceMapDevToolPlugin:
this._addImport('webpack', 'SourceMapDevToolPlugin');
break;
case webpack.optimize.UglifyJsPlugin:
this._addImport('webpack.optimize', 'UglifyJsPlugin');
break;
Expand Down

0 comments on commit bd0dac1

Please sign in to comment.