From 9953fe7c00de6ffcab95600314d9789bf6d8996b Mon Sep 17 00:00:00 2001 From: JoostK Date: Sun, 23 Sep 2018 22:44:07 +0200 Subject: [PATCH] fix(ivy): reexport compileNgModuleFactory__POST_NGCC__ to prevent DCE in FESM (#26071) While creating FESM files, rollup usually drops all unused symbols. All *__POST_NGCC__ are unused unless ngcc rewires stuff. To prevent this DCE we reexport them as private symbols. If ngcc is not used, these symbols will be dropped when we optimize an application bundle. PR Close #26071 --- packages/core/src/application_ref.ts | 2 +- packages/core/src/core_render3_private_export.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/core/src/application_ref.ts b/packages/core/src/application_ref.ts index c6979b8a03..810b339983 100644 --- a/packages/core/src/application_ref.ts +++ b/packages/core/src/application_ref.ts @@ -43,7 +43,7 @@ function compileNgModuleFactory__PRE_NGCC__( return compiler.compileModuleAsync(moduleType); } -function compileNgModuleFactory__POST_NGCC__( +export function compileNgModuleFactory__POST_NGCC__( injector: Injector, options: CompilerOptions, moduleType: Type): Promise> { ngDevMode && assertNgModuleType(moduleType); diff --git a/packages/core/src/core_render3_private_export.ts b/packages/core/src/core_render3_private_export.ts index b2ef5d6372..29e6c4eaa0 100644 --- a/packages/core/src/core_render3_private_export.ts +++ b/packages/core/src/core_render3_private_export.ts @@ -175,6 +175,9 @@ export { // performed by rollup while it's creating fesm files. // // no code actually imports these symbols from the @angular/core entry point +export { + compileNgModuleFactory__POST_NGCC__ as ɵcompileNgModuleFactory__POST_NGCC__ +} from './application_ref'; export { R3_COMPILE_COMPONENT__POST_NGCC__ as ɵR3_COMPILE_COMPONENT__POST_NGCC__, R3_COMPILE_DIRECTIVE__POST_NGCC__ as ɵR3_COMPILE_DIRECTIVE__POST_NGCC__,