fix(ivy): prevent ngcc from referencing missing ɵsetClassMetadata (#27055)
When ngtsc compiles @angular/core, it rewrites core imports to the r3_symbols.ts file that exposes all internal symbols under their external name. When creating the FESM bundle, the r3_symbols.ts file causes the external symbol names to be rewritten to their internal name. Under ngcc compilations of FESM bundles, the indirection of r3_symbols.ts is no longer in place such that the external names are retained in the bundle. Previously, the external name `ɵdefineNgModule` was explicitly declared internally to resolve this issue, but the recently added `setClassMetadata` was not declared as such, causing runtime errors. Instead of relying on the r3_symbols.ts file to perform the rewrite of the external modules to their internal variants, the translation is moved into the `ImportManager` during the compilation itself. This avoids the need for providing the external name manually. PR Close #27055
This commit is contained in:
@ -7,15 +7,12 @@
|
||||
*/
|
||||
|
||||
// clang-format off
|
||||
// We need to have `ɵdefineNgModule` defined locally for flat-file ngcc compilation.
|
||||
// More details in the commit where this is added.
|
||||
import {defineNgModule} from './render3/index';
|
||||
export const ɵdefineNgModule = defineNgModule;
|
||||
export {
|
||||
defineBase as ɵdefineBase,
|
||||
defineComponent as ɵdefineComponent,
|
||||
defineDirective as ɵdefineDirective,
|
||||
definePipe as ɵdefinePipe,
|
||||
defineNgModule as ɵdefineNgModule,
|
||||
detectChanges as ɵdetectChanges,
|
||||
renderComponent as ɵrenderComponent,
|
||||
ComponentType as ɵComponentType,
|
||||
|
@ -14,17 +14,18 @@
|
||||
* compiler writes imports to this file.
|
||||
*
|
||||
* Only a subset of such imports are supported - core is not allowed to declare components or pipes.
|
||||
* A check in ngtsc's translator.ts validates this condition.
|
||||
* A check in ngtsc's translator.ts validates this condition. The translator is responsible for
|
||||
* translating an external name (prefixed with ɵ) to the internal symbol name as exported below.
|
||||
*
|
||||
* The below symbols are used for @Injectable and @NgModule compilation.
|
||||
*/
|
||||
|
||||
export {InjectableDef as ɵInjectableDef, InjectorDef as ɵInjectorDef, defineInjectable, defineInjector} from './di/defs';
|
||||
export {InjectableDef, InjectorDef, defineInjectable, defineInjector} from './di/defs';
|
||||
export {inject} from './di/injector_compatibility';
|
||||
export {NgModuleDef as ɵNgModuleDef, NgModuleDefWithMeta as ɵNgModuleDefWithMeta} from './metadata/ng_module';
|
||||
export {defineNgModule as ɵdefineNgModule} from './render3/definition';
|
||||
export {setClassMetadata as ɵsetClassMetadata} from './render3/metadata';
|
||||
export {NgModuleFactory as ɵNgModuleFactory} from './render3/ng_module_ref';
|
||||
export {NgModuleDef, NgModuleDefWithMeta} from './metadata/ng_module';
|
||||
export {defineNgModule} from './render3/definition';
|
||||
export {setClassMetadata} from './render3/metadata';
|
||||
export {NgModuleFactory} from './render3/ng_module_ref';
|
||||
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user