shibbir / generator-angular2-typescript

Yeoman generator to scaffold out a front-end project with angular, typescript, webpack and much more..
https://www.npmjs.com/package/generator-angular2-typescript
MIT License
35 stars 7 forks source link

Use the offline compiler for Webpack #5

Open Meligy opened 8 years ago

Meligy commented 8 years ago

I discovered this gem the other day, ngc-loader, by one of the Webpack core team members.

Would it make sense to try to add it to the project? I asked the guy on twitter and he said that the AngularClass starter uses it (I couldn't see where), and he said a few other ones but didn't specify.

I realise you already try to do something related to precompilation, seeing some precompile property in the AppComponent's @Component.

Would that be a good idea, or you rather wait for Application Modules or something?

I think this one is usable now though. Still sharpening my own Webpack skills so not sure of all the details.

shibbir commented 8 years ago

I agree that would be nice feature. Angular 2 offline template compiler is very useful. I'll need some time to study more or may be wait for the full release. I'll get back to it ASAP. I am also new to webpack :)

And the precompile property you see in AppComponent's @Component defines the components that should be precompiled as well when this AppComponent is defined. The new angular router needs the registered components for the router to be precompiled. Otherwise It will give a warning message.

https://github.com/angular/angular/blob/6c5b653593eff19c5b9342b2cf0195aca49379cb/modules/%40angular/core/src/metadata/directives.ts#L968

zmitry commented 8 years ago