fix(core): workaround Terser inlining bug (#36200)
This variable name change works around https://github.com/terser/terser/issues/615, which was causing the JIT production tests to fail in the Angular CLI repository (https://github.com/angular/angular-cli/issues/17264). PR Close #36200
This commit is contained in:
parent
528e25a81a
commit
0ce8ad3493
@ -69,19 +69,23 @@ export function compileComponent(type: Type<any>, metadata: Component): void {
|
|||||||
throw new Error(error.join('\n'));
|
throw new Error(error.join('\n'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const jitOptions = getJitOptions();
|
// This const was called `jitOptions` previously but had to be renamed to `options` because
|
||||||
|
// of a bug with Terser that caused optimized JIT builds to throw a `ReferenceError`.
|
||||||
|
// This bug was investigated in https://github.com/angular/angular-cli/issues/17264.
|
||||||
|
// We should not rename it back until https://github.com/terser/terser/issues/615 is fixed.
|
||||||
|
const options = getJitOptions();
|
||||||
let preserveWhitespaces = metadata.preserveWhitespaces;
|
let preserveWhitespaces = metadata.preserveWhitespaces;
|
||||||
if (preserveWhitespaces === undefined) {
|
if (preserveWhitespaces === undefined) {
|
||||||
if (jitOptions !== null && jitOptions.preserveWhitespaces !== undefined) {
|
if (options !== null && options.preserveWhitespaces !== undefined) {
|
||||||
preserveWhitespaces = jitOptions.preserveWhitespaces;
|
preserveWhitespaces = options.preserveWhitespaces;
|
||||||
} else {
|
} else {
|
||||||
preserveWhitespaces = false;
|
preserveWhitespaces = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let encapsulation = metadata.encapsulation;
|
let encapsulation = metadata.encapsulation;
|
||||||
if (encapsulation === undefined) {
|
if (encapsulation === undefined) {
|
||||||
if (jitOptions !== null && jitOptions.defaultEncapsulation !== undefined) {
|
if (options !== null && options.defaultEncapsulation !== undefined) {
|
||||||
encapsulation = jitOptions.defaultEncapsulation;
|
encapsulation = options.defaultEncapsulation;
|
||||||
} else {
|
} else {
|
||||||
encapsulation = ViewEncapsulation.Emulated;
|
encapsulation = ViewEncapsulation.Emulated;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user