I have an app that lazy loads its feature components. Everything is fine and dandy as long as I don't AOT compile (which after days of struggling I got working).
My initial page load is super quick now. However, when I click any of my nav links which are supposed to lazy load that feature, I get a 404 and rightly so. There is a request being made to myfeature.module.ngfactory.js but this file does not exist. I have followed the cookbook on the dev site but it does not go into details on how to get lazy loads working. I see that my AOT compile creates a myfeature.module.ngfactory.ts but does not create a myfeature.module.ngfactory.js file. How do I go about creating this file?
My tsconfig-aot.json file looks like this:
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es2015",
"dom"
],
"module": "es2015",
"moduleResolution": "node",
"noImplicitAny": false,
"sourceMap": true,
"suppressImplicitAnyIndexErrors": true,
"target": "es5"
},
"files": [
"app/shared/shared.module.ts",
"app/app.module.ts",
"app/myfeature/myfeature.module.ts",
"main.ts"
],
"angularCompilerOptions": {
"skipMetadataEmit": true
},
"exclude": [
"node_modules/*",
"**/*-aot.ts"
]
}
I feel like I am missing something. Looks like the bootstrap process is the one that creates app.module.ngfactory.js but there is nothing triggering the creation of myfeature.module.ngfactory.js.