Skip to content

Commit

Permalink
refactor(@angular-devkit/build-angular): don't add a SourceMapDevTool…
Browse files Browse the repository at this point in the history
…Plugin when sourcemaps are disabled
  • Loading branch information
alan-agius4 authored and Keen Yee Liau committed Dec 6, 2019
1 parent 6f4fef5 commit 614820d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export function getBrowserConfig(wco: WebpackConfigOptions): webpack.Configurati

if (!isEval && (scriptsSourceMap || stylesSourceMap)) {
extraPlugins.push(getSourceMapDevTool(
!!scriptsSourceMap,
!!stylesSourceMap,
scriptsSourceMap,
stylesSourceMap,
wco.differentialLoadingMode ? true : hiddenSourceMap,
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export function getServerConfig(wco: WebpackConfigOptions): Configuration {
const extraPlugins = [];
if (sourceMap) {
const { scripts, styles, hidden } = sourceMap;
extraPlugins.push(getSourceMapDevTool(scripts || false, styles || false, hidden || false));
if (scripts || styles) {
extraPlugins.push(getSourceMapDevTool(scripts, styles, hidden));
}
}

const config: Configuration = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ export function getTestConfig(
if (wco.buildOptions.sourceMap) {
const { styles, scripts } = wco.buildOptions.sourceMap;

extraPlugins.push(getSourceMapDevTool(
scripts || false,
styles || false,
false,
true,
));
if (styles || scripts) {
extraPlugins.push(getSourceMapDevTool(
scripts,
styles,
false,
true,
));
}
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export function normalizeExtraEntryPoints(
}

export function getSourceMapDevTool(
scriptsSourceMap: boolean,
stylesSourceMap: boolean,
scriptsSourceMap: boolean | undefined,
stylesSourceMap: boolean | undefined,
hiddenSourceMap = false,
inlineSourceMap = false,
): SourceMapDevToolPlugin {
Expand Down

0 comments on commit 614820d

Please sign in to comment.