FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(@angular-devkit/build-angular): control linker template sourcemapping via builder sourcemap options by clydin · Pull Request #21155 · angular/angular-cli · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .ts  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface ApplicationPresetOptions {
angularLinker?: {
shouldLink: boolean;
jitMode: boolean;
sourcemap: boolean;
};

forceES5?: boolean;
Expand All @@ -31,7 +32,8 @@ export interface ApplicationPresetOptions {
type I18nDiagnostics = import('@angular/localize/src/tools/src/diagnostics').Diagnostics;
function createI18nDiagnostics(reporter: DiagnosticReporter | undefined): I18nDiagnostics {
// Babel currently is synchronous so import cannot be used
const diagnostics: I18nDiagnostics = new (require('@angular/localize/src/tools/src/diagnostics').Diagnostics)();
const diagnostics: I18nDiagnostics =
new (require('@angular/localize/src/tools/src/diagnostics').Diagnostics)();

if (!reporter) {
return diagnostics;
Expand Down Expand Up @@ -130,13 +132,13 @@ export default function (api: unknown, options: ApplicationPresetOptions) {

if (options.angularLinker?.shouldLink) {
// Babel currently is synchronous so import cannot be used
const {
createEs2015LinkerPlugin,
} = require('@angular/compiler-cli/linker/babel') as typeof import('@angular/compiler-cli/linker/babel');
const { createEs2015LinkerPlugin } =
require('@angular/compiler-cli/linker/babel') as typeof import('@angular/compiler-cli/linker/babel');

plugins.push(
createEs2015LinkerPlugin({
linkerJitMode: options.angularLinker.jitMode,
sourceMapping: options.angularLinker.sourcemap,
logger: createNgtscLogger(options.diagnosticReporter),
fileSystem: {
resolve: path.resolve,
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default custom<AngularCustomOptions>(() => {
customOptions.angularLinker = {
shouldLink: true,
jitMode: aot !== true,
sourcemap: false,
};
shouldProcess = true;
}
Expand Down Expand Up @@ -140,6 +141,15 @@ export default custom<AngularCustomOptions>(() => {
);
}

// 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
Expand Down

Back | FazBrowse Home | New Git URL