Skip to content

Commit 438266a

Browse files
clydinhansl
authored andcommitted
refactor(@angular-devkit/build-webpack): simplify source map config
1 parent 19c19d5 commit 438266a

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

  • packages/angular_devkit/build_webpack/src/angular-cli-files/models/webpack-configs

packages/angular_devkit/build_webpack/src/angular-cli-files/models/webpack-configs/browser.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// tslint:disable
22
// TODO: cleanup this file, it's copied as is from Angular CLI.
33

4-
import * as webpack from 'webpack';
54
import * as path from 'path';
65
const HtmlWebpackPlugin = require('html-webpack-plugin');
76
const SubresourceIntegrityPlugin = require('webpack-subresource-integrity');
@@ -51,23 +50,15 @@ export function getBrowserConfig(wco: WebpackConfigOptions) {
5150
}));
5251
}
5352

53+
let sourcemaps: string | false = false;
5454
if (buildOptions.sourceMap) {
55-
// TODO: see if this is still needed with webpack 4 'mode'.
5655
// See https://webpack.js.org/configuration/devtool/ for sourcemap types.
5756
if (buildOptions.evalSourceMap && buildOptions.optimizationLevel === 0) {
5857
// Produce eval sourcemaps for development with serve, which are faster.
59-
extraPlugins.push(new webpack.EvalSourceMapDevToolPlugin({
60-
moduleFilenameTemplate: '[resource-path]',
61-
sourceRoot: 'webpack:///'
62-
}));
58+
sourcemaps = 'eval';
6359
} else {
6460
// Produce full separate sourcemaps for production.
65-
extraPlugins.push(new webpack.SourceMapDevToolPlugin({
66-
filename: '[file].map[query]',
67-
moduleFilenameTemplate: '[resource-path]',
68-
fallbackModuleFilenameTemplate: '[resource-path]?[hash]',
69-
sourceRoot: 'webpack:///'
70-
}));
61+
sourcemaps = 'source-map';
7162
}
7263
}
7364

@@ -90,6 +81,7 @@ export function getBrowserConfig(wco: WebpackConfigOptions) {
9081
.map(style => style.entry);
9182

9283
return {
84+
devtool: sourcemaps,
9385
resolve: {
9486
mainFields: [
9587
...(wco.supportES2015 ? ['es2015'] : []),

0 commit comments

Comments
 (0)