SamVerschueren / ng2-hello-world-lazy-routing

Angular2 Hello World lazy routing application
4 stars 0 forks source link

Add production steps (AoT + Treeshaking) #2

Open SamVerschueren opened 7 years ago

SamVerschueren commented 7 years ago

Currently, the outpunt bundles uses JiT compilation and doesnt have treeshaking. This means the main bundle is still more tham 1.5 MB in size and nowhere near to 40 kB.

Not sure how to do this properly. Can we use Rollup for this (which doesn't support code splitting) or should we have a look to something like Google Closure Compiler?

ocombe commented 7 years ago

webpack 2 does tree shaking by the way

SamVerschueren commented 7 years ago

Thanks for letting me know. I want to create examples for webpack as well because (a) I never used it and (b) it would be nice to have it as a reference.

ocombe commented 7 years ago

it's not that hard to learn now that they have the new docs: http://webpack.js.org/ if you need help, ask me :)

aelbore commented 7 years ago

maybe this? they implemented tree shaking using gulp-rollup https://github.com/jvandemo/generator-angular2-library

SamVerschueren commented 7 years ago

Treeshaking is not the real problem here, the problem is lazy loading in combination with tree shaking which is a much harder nut to crack and is not possible with Rollup because it does not offer code splitting which is used for lazy loading.