diff --git a/integration/_payload-limits.json b/integration/_payload-limits.json index 8441e070c9..21cb9fbcb1 100644 --- a/integration/_payload-limits.json +++ b/integration/_payload-limits.json @@ -60,7 +60,7 @@ "uncompressed": { "bundle": "TODO(i): temporarily increase the payload size limit from 105779 - this is due to a closure issue related to ESM reexports that still needs to be investigated", "bundle": "TODO(i): we should define ngDevMode to false in Closure, but --define only works in the global scope.", - "bundle": 175498 + "bundle": 170618 } } } diff --git a/packages/core/src/render3/di.ts b/packages/core/src/render3/di.ts index 72dd5d85c8..c70505a2d1 100644 --- a/packages/core/src/render3/di.ts +++ b/packages/core/src/render3/di.ts @@ -14,6 +14,7 @@ import {getInjectorDef} from '../di/interface/defs'; import {InjectFlags} from '../di/interface/injector'; import {Type} from '../interface/type'; import {assertDefined, assertEqual} from '../util/assert'; +import {noSideEffects} from '../util/closure'; import {assertDirectiveDef} from './assert'; import {getFactoryDef} from './definition'; @@ -655,15 +656,17 @@ export function ɵɵgetFactoryOf(type: Type): FactoryFn|null { * @codeGenApi */ export function ɵɵgetInheritedFactory(type: Type): (type: Type) => T { - const proto = Object.getPrototypeOf(type.prototype).constructor as Type; - const factory = (proto as any)[NG_FACTORY_DEF] || ɵɵgetFactoryOf(proto); - if (factory !== null) { - return factory; - } else { - // There is no factory defined. Either this was improper usage of inheritance - // (no Angular decorator on the superclass) or there is no constructor at all - // in the inheritance chain. Since the two cases cannot be distinguished, the - // latter has to be assumed. - return (t) => new t(); - } + return noSideEffects(() => { + const proto = Object.getPrototypeOf(type.prototype).constructor as Type; + const factory = (proto as any)[NG_FACTORY_DEF] || ɵɵgetFactoryOf(proto); + if (factory !== null) { + return factory; + } else { + // There is no factory defined. Either this was improper usage of inheritance + // (no Angular decorator on the superclass) or there is no constructor at all + // in the inheritance chain. Since the two cases cannot be distinguished, the + // latter has to be assumed. + return (t) => new t(); + } + }); } diff --git a/packages/core/test/bundling/cyclic_import/bundle.golden_symbols.json b/packages/core/test/bundling/cyclic_import/bundle.golden_symbols.json index facce6d3a7..7470bbe21e 100644 --- a/packages/core/test/bundling/cyclic_import/bundle.golden_symbols.json +++ b/packages/core/test/bundling/cyclic_import/bundle.golden_symbols.json @@ -167,6 +167,9 @@ { "name": "attachPatchData" }, + { + "name": "autoRegisterModuleById" + }, { "name": "baseResolveDirective" },