perf: distrubute smaller bundled code and include es2015 bundle
TypeScript compiler will now build to ES2015 code and modules. Babili is used to minify ES2015 code, providing an initial optimization that we couldn't previously get just from Uglify. Uses Babel to convert ES2015 to UMD/ES5 code, and Uglify to minimize the output.
This commit is contained in:
1
integration/.gitignore
vendored
1
integration/.gitignore
vendored
@ -7,3 +7,4 @@ vendor/
|
||||
**/*.ngfactory.ts
|
||||
**/*.ngsummary.json
|
||||
*/yarn*
|
||||
*/.yarn_local_cache*
|
||||
|
@ -35,7 +35,6 @@ Angular's `node_modules` is installed.
|
||||
The first time you run the tests, you'll need some setup:
|
||||
|
||||
```shell
|
||||
$ EXPERIMENTAL_ES2015_DISTRO=1 ./build.sh
|
||||
$ ./integration/build_rxjs_es6.sh
|
||||
```
|
||||
|
||||
@ -44,7 +43,7 @@ See the `package.json` of the test(s) you're debugging, to see which dist/ folde
|
||||
Then run the right `tsc --watch` command to keep those dist folders up-to-date, for example:
|
||||
|
||||
```
|
||||
$ ./node_modules/.bin/tsc -p modules/@angular/core/tsconfig-build.json --target es2015 --outDir dist/packages-dist-es2015/core --watch
|
||||
$ ./node_modules/.bin/tsc -p modules/@angular/core/tsconfig-build.json --outDir dist/packages-dist/core --watch
|
||||
```
|
||||
|
||||
Now you can run the integration test, it will re-install from the dist/ folder on each run.
|
||||
|
@ -25,7 +25,10 @@ CLOSURE_ARGS=(
|
||||
"--rewrite_polyfills=false"
|
||||
|
||||
# List of path prefixes to be removed from ES6 & CommonJS modules.
|
||||
"--js_module_root=node_modules"
|
||||
"--js_module_root=node_modules/@angular/core"
|
||||
"--js_module_root=node_modules/@angular/common"
|
||||
"--js_module_root=node_modules/@angular/compiler"
|
||||
"--js_module_root=node_modules/@angular/platform-browser"
|
||||
"--js_module_root=vendor"
|
||||
|
||||
# Uncomment for easier debugging
|
||||
@ -34,9 +37,10 @@ CLOSURE_ARGS=(
|
||||
e2e/testability.externs.js
|
||||
node_modules/zone.js/dist/zone.js
|
||||
$(find -L vendor/rxjs -name *.js)
|
||||
node_modules/@angular/{core,common,compiler,platform-browser}/index.js
|
||||
node_modules/@angular/{core,common}/public_api.js
|
||||
$(find node_modules/@angular/{core,common,compiler,platform-browser}/src -name *.js)
|
||||
node_modules/@angular/core/@angular/core.js
|
||||
node_modules/@angular/common/@angular/common.js
|
||||
node_modules/@angular/compiler/@angular/compiler.js
|
||||
node_modules/@angular/platform-browser/@angular/platform-browser.js
|
||||
"built/src/*.js"
|
||||
"--entry_point=./built/src/main"
|
||||
)
|
||||
|
@ -3,12 +3,12 @@
|
||||
"version": "0.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@angular/common": "file:../../dist/packages-dist-es2015/common",
|
||||
"@angular/compiler": "file:../../dist/packages-dist-es2015/compiler",
|
||||
"@angular/compiler-cli": "file:../../dist/packages-dist-es2015/compiler-cli",
|
||||
"@angular/core": "file:../../dist/packages-dist-es2015/core",
|
||||
"@angular/platform-browser": "file:../../dist/packages-dist-es2015/platform-browser",
|
||||
"@angular/platform-server": "file:../../dist/packages-dist-es2015/platform-server",
|
||||
"@angular/common": "file:../../dist/packages-dist/common",
|
||||
"@angular/compiler": "file:../../dist/packages-dist/compiler",
|
||||
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
|
||||
"@angular/core": "file:../../dist/packages-dist/core",
|
||||
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
|
||||
"@angular/platform-server": "file:../../dist/packages-dist/platform-server",
|
||||
"@angular/tsc-wrapped": "file:../../dist/tools/@angular/tsc-wrapped",
|
||||
"google-closure-compiler": "20161201.0.0",
|
||||
"rxjs": "file:../../node_modules/rxjs",
|
||||
|
@ -10,12 +10,6 @@ if [ ! -d "rxjs/dist/es6" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "../dist/packages-dist-es2015" ]; then
|
||||
echo "You must build the ES2015 distro for some tests:"
|
||||
echo "EXPERIMENTAL_ES2015_DISTRO=1 ./build.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Workaround https://github.com/yarnpkg/yarn/issues/2165
|
||||
# Yarn will cache file://dist URIs and not update Angular code
|
||||
readonly cache=.yarn_local_cache
|
||||
|
Reference in New Issue
Block a user