@@ -87,6 +87,23 @@ function _replaceBootstrap(plugin: AotPlugin, refactor: TypeScriptFileRefactor)
87
87
refactor . insertImport ( entryModule . className + 'NgFactory' , ngFactoryPath ) ;
88
88
}
89
89
90
+ function _removeModuleId ( refactor : TypeScriptFileRefactor ) {
91
+ const sourceFile = refactor . sourceFile ;
92
+
93
+ refactor . findAstNodes ( sourceFile , ts . SyntaxKind . ObjectLiteralExpression , true )
94
+ // Get all their property assignments.
95
+ . filter ( ( node : ts . ObjectLiteralExpression ) =>
96
+ node . properties . some ( prop => prop . name . getText ( ) == 'moduleId' ) )
97
+ . forEach ( ( node : ts . ObjectLiteralExpression ) => {
98
+ const moduleIdProp = node . properties . filter ( ( prop : ts . ObjectLiteralElement , idx : number ) => {
99
+ return prop . name . getText ( ) == 'moduleId' ;
100
+ } ) [ 0 ] ;
101
+ // get the trailing comma
102
+ const moduleIdCommaProp = moduleIdProp . parent . getChildAt ( 1 ) . getChildren ( ) [ 1 ] ;
103
+ refactor . removeNodes ( moduleIdProp , moduleIdCommaProp ) ;
104
+ } ) ;
105
+ }
106
+
90
107
function _replaceResources ( refactor : TypeScriptFileRefactor ) : void {
91
108
const sourceFile = refactor . sourceFile ;
92
109
@@ -163,7 +180,9 @@ export function ngcLoader(source: string) {
163
180
. then ( ( ) => _removeDecorators ( refactor ) )
164
181
. then ( ( ) => _replaceBootstrap ( plugin , refactor ) ) ;
165
182
} else {
166
- return _replaceResources ( refactor ) ;
183
+ return Promise . resolve ( )
184
+ . then ( ( ) => _replaceResources ( refactor ) )
185
+ . then ( ( ) => _removeModuleId ( refactor ) ) ;
167
186
}
168
187
} )
169
188
. then ( ( ) => {
0 commit comments