Closed
Description
OS
Mac OSX (El Capitan)
Versions.
Angular 2.4.4 / CLI Beta.24
Repro steps.
Refactored a module, 'FooModule', into another repository, and used ngc to make it into an AoT compatible library
In main application, I npm install'd my library, and imported it for use,
pages/foo/module.ts:
import { FooModule, FOO_CONFIG } from "my-component-library"
@NgModule({
imports: [ FooModule ],
providers: [ { provide: FOO_CONFIG, useValue: { title: 'hello bar' } } ]
})
export class WrappedFooModule {}
routes.ts:
... { path: 'foo', loadChildren: 'pages/foo/module#WrappedFooModule' } ...
The log given by the failure.
Examining foo.chunk.js, I can see my entire template source:
template: '<div><h1>Foo component</h1><*ngIf="bar">...</div>'
But I also see the AoT pre-compiled code:
... this.renderer.createText(this._el_6, "Foo component", null)) ...
This was not the case prior to the refactoring. Prior, the same chunk only had AoT compiled code.
Also, I refactored some components that are not lazy loaded at all. Prior, these eager components were in the main.bundle.js, only as aot-compiled code. After refactoring, these eager components are in vendor.bundle.js (as expected), but only as a template-source.