-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Use Closure Compiler with offline template compiler #8550
Copy link
Copy link
Closed
Labels
area: packagingIssues related to Angular's creation of npm packagesIssues related to Angular's creation of npm packagesfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfreq2: medium
Description
Angular's new offline compiler was demo'ed at ng-conf day 2 keynote by @robwormald. It generates tree-shakable ES6 code. Four steps are then required:
- run a tree-shaker to remove ES6 modules not reachable from the entry point, in our demo we showed rollup
- run a bundler to reduce down the module imports into a declarations in a single file; we showed system.js
- down-level to ES5 - we showed this with TypeScript
- minify to shorten symbol names, we used uglify.
This produced a 49k JS file, but requires a lot of configuration.
Google's Closure Compiler (https://developers.google.com/closure/compiler/) produces very small JS. It does all four steps required above, so the configuration should be a lot simpler. We also suspect we can get a smaller binary size for ng2-hello-world, around 36k.
Wiring this up requires:
- add tsickle's closure annotation helper to `ngc
- modify Angular's ES6 distribution to be closure-compiler compatible
- ?? modify ES6 distro of our dependencies (rxjs, zone.js) to be closure-compiler compatible
- figure out a minimal build (maybe a shell script) that successfully compiles the application together with the framework and its dependencies
- document how we did it so others can repro
- bundle externs with Angular to allow Protractor testing (the
BrowserNodeGlobaltype)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: packagingIssues related to Angular's creation of npm packagesIssues related to Angular's creation of npm packagesfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfreq2: medium