From da74c6e65baa01a6d1e00aed94de27a5b9527a26 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Mon, 5 Jul 2021 09:24:03 +0200 Subject: [PATCH] Revert "fix(@angular-devkit/build-angular): control linker template sourcemapping via builder sourcemap options" This reverts commit d4c5f8518d4801b9fd76de289a015dcbb8d8f69b. Following a debugging and investigation with @petebacondarwin it appears that when the external template handling in the linker generates Babel AST nodes that reference the external template files which breaks Babel when it tried to flatten final source-map, which ends up no emitting any source-maps. As an interim solution we should revert this. Closes #21271 --- .../build_angular/src/babel/presets/application.ts | 2 -- .../build_angular/src/babel/webpack-loader.ts | 10 ---------- 2 files changed, 12 deletions(-) diff --git a/packages/angular_devkit/build_angular/src/babel/presets/application.ts b/packages/angular_devkit/build_angular/src/babel/presets/application.ts index c34c5431e4f0..5a092f6d89a9 100644 --- a/packages/angular_devkit/build_angular/src/babel/presets/application.ts +++ b/packages/angular_devkit/build_angular/src/babel/presets/application.ts @@ -20,7 +20,6 @@ export interface ApplicationPresetOptions { angularLinker?: { shouldLink: boolean; jitMode: boolean; - sourcemap: boolean; }; forceES5?: boolean; @@ -138,7 +137,6 @@ export default function (api: unknown, options: ApplicationPresetOptions) { plugins.push( createEs2015LinkerPlugin({ linkerJitMode: options.angularLinker.jitMode, - sourceMapping: options.angularLinker.sourcemap, logger: createNgtscLogger(options.diagnosticReporter), fileSystem: { resolve: path.resolve, diff --git a/packages/angular_devkit/build_angular/src/babel/webpack-loader.ts b/packages/angular_devkit/build_angular/src/babel/webpack-loader.ts index dbbc248b1045..ba6b2583e1c3 100644 --- a/packages/angular_devkit/build_angular/src/babel/webpack-loader.ts +++ b/packages/angular_devkit/build_angular/src/babel/webpack-loader.ts @@ -58,7 +58,6 @@ export default custom(() => { customOptions.angularLinker = { shouldLink: true, jitMode: aot !== true, - sourcemap: false, }; shouldProcess = true; } @@ -141,15 +140,6 @@ export default custom(() => { ); } - // Only enable linker template sourcemapping if linker is enabled and Webpack provides - // a sourcemap. This logic allows the linker sourcemap behavior to be controlled by the - // Webpack sourcemap configuration. For example, if a vendor file is being processed - // and vendor sourcemaps are disabled, the `inputSourceMap` property will be `undefined` - // which will effectively disable linker sourcemapping for vendor files. - if (customOptions.angularLinker && configuration.options.inputSourceMap) { - customOptions.angularLinker.sourcemap = true; - } - return { ...configuration.options, // Workaround for https://github.com/babel/babel-loader/pull/896 is available