11// tslint:disable
22// TODO: cleanup this file, it's copied as is from Angular CLI.
33
4- import * as webpack from 'webpack' ;
54import * as path from 'path' ;
65const HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
76const 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