Answer the question
In order to leave comments, you need to log in
Why does the application crash with the error "undefined is not iterable" when building AOT?
I'm using the Compiler from "@angular/core" to create components on the fly. Normal assembly works fine, the application works without problems.
But, when I build with the --prod flag , it includes the following build options:
"optimization": true,
"outputHashing": "none",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"serviceWorker": true
undefined is not iterable (cannot read property Symbol(Symbol.iterator))
export function createJitCompiler() {
return new JitCompilerFactory().createCompiler([{useJit: true}]);
}
@NgModule({
imports: [
CommonModule
],
exports: [
DynamicComponent
],
declarations: [
DynamicComponent
]
})
export class DynamicLoaderModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: DynamicLoaderModule,
providers: [
{provide: Compiler, useFactory: createJitCompiler},
{provide: NgModuleFactoryLoader, useClass: ModuleLoader}
]
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question