Skip to content

Commit d65f30c

Browse files
committed
fix(core): disable tsickle pass when producing APF packages
As of TypeScript 3.9, the tsc emit is not compatible with Closure Compiler due to microsoft/TypeScript#32011. There is some hope that this will be fixed by a solution like the one proposed in microsoft/TypeScript#38374 but currently it's unclear if / when that will happen. Since the Closure support has been somewhat already broken, and the tsickle pass has been a source of headaches for some time for Angular packages, we are removing it for now while we rethink our strategy to make Angular Closure compatible outside of Google. This change has no affect on our Closure compatibility within Google which work well because all the code is compiled from sources and passed through tsickle. This change only disables the tsickle pass but doesn't remove it. A follow up PR should either remove all the traces of tscikle or re-enable the fixed version. BREAKING CHANGE: Angular npm packages no longer contain jsdoc comments to support Closure Compiler's advanced optimizations The support for Closure compiler in Angular packages has been experimental and broken for quite some time. As of TS3.9 Closure is unusable with the JavaScript emit. Please follow microsoft/TypeScript#38374 for more information and updates. If you used Closure compiler with Angular in the past, you will likely be better off consuming Angular packages built from sources directly rather than consuming the version we publish on npm which is primarily optimized for Webpack/Rollup + Terser build pipeline. As a temporary workaround you might consider using your current build pipeline with Closure flag `--compilation_level=SIMPLE`. This flag will ensure that your build pipeline produces buildable and runnable artifacts, at the cost of increased payload size due to advanced optimizations being disabled.
1 parent 6ca3fb1 commit d65f30c

File tree

28 files changed

+1019
-2371
lines changed

28 files changed

+1019
-2371
lines changed

goldens/size-tracking/aio-payloads.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"master": {
2222
"uncompressed": {
2323
"runtime-es2015": 3097,
24-
"main-es2015": 430367,
24+
"main-es2015": 429710,
2525
"polyfills-es2015": 52195
2626
}
2727
}

goldens/size-tracking/integration-payloads.json

+8-7
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"master": {
44
"uncompressed": {
55
"runtime-es2015": 1485,
6-
"main-es2015": 143315,
7-
"polyfills-es2015": 36657
6+
"main-es2015": 142590,
7+
"polyfills-es2015": 36963
88
}
99
}
1010
},
@@ -21,17 +21,17 @@
2121
"master": {
2222
"uncompressed": {
2323
"runtime-es2015": 1485,
24-
"main-es2015": 149436,
25-
"polyfills-es2015": 36657
24+
"main-es2015": 148510,
25+
"polyfills-es2015": 36963
2626
}
2727
}
2828
},
2929
"cli-hello-world-ivy-i18n": {
3030
"master": {
3131
"uncompressed": {
3232
"runtime-es2015": 1485,
33-
"main-es2015": 138866,
34-
"polyfills-es2015": 37334
33+
"main-es2015": 138196,
34+
"polyfills-es2015": 37640
3535
}
3636
}
3737
},
@@ -61,7 +61,8 @@
6161
"bundle": "TODO(i): temporarily increase the payload size limit from 105779 - this is due to a closure issue related to ESM reexports that still needs to be investigated",
6262
"bundle": "TODO(i): we should define ngDevMode to false in Closure, but --define only works in the global scope.",
6363
"bundle": "TODO(i): (FW-2164) TS 3.9 new class shape seems to have broken Closure in big ways. The size went from 169991 to 252338",
64-
"bundle": 252338
64+
"bundle": "TODO(i): after removal of tsickle from ngc-wrapped / ng_package, we had to switch to SIMPLE optimizations which increased the size from 252338 to 1218969, see PR#37221 for more info"
65+
"bundle": 1218969
6566
}
6667
}
6768
}

integration/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ load(":angular_integration_test.bzl", "angular_integration_test")
55
#
66
# Where `ng e2e` is used we pass `ng e2e --port 0` which prompts the cli
77
# to select a random free port for the the e2e test. The protractor.conf is
8-
# automaticaly updated to use this port.
8+
# automatically updated to use this port.
99
#
1010
# Karma automatically finds a free port so no effort is needed there.
1111
#

integration/angular_integration_test.bzl

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ load("//tools/npm_integration_test:npm_integration_test.bzl", "npm_integration_t
1212
NPM_PACKAGE_ARCHIVES = [
1313
"check-side-effects",
1414
"core-js",
15+
"google-closure-compiler",
1516
"jasmine",
1617
"typescript",
1718
"rxjs",
+11-15
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,36 @@
1-
--compilation_level=ADVANCED_OPTIMIZATIONS
2-
--language_out=ES5
1+
--compilation_level=SIMPLE
2+
--language_in=ECMASCRIPT_2015
3+
--language_out=ECMASCRIPT_2015
34
--js_output_file=dist/bundle.js
45
--output_manifest=dist/manifest.MF
56
--variable_renaming_report=dist/variable_renaming_report
67
--property_renaming_report=dist/property_renaming_report
78
--create_source_map=%outname%.map
89

910
--warning_level=QUIET
10-
--dependency_mode=STRICT
11+
--dependency_mode=PRUNE
1112
--rewrite_polyfills=false
12-
--jscomp_off=checkVars
13+
14+
--module_resolution=node
15+
--package_json_entry_names es2015,module
1316

1417
node_modules/zone.js/dist/zone_externs.js
1518

19+
--js node_modules/tslib/package.json
20+
--js node_modules/tslib/**.js
21+
1622
--js node_modules/rxjs/package.json
17-
--js node_modules/rxjs/_esm2015/index.js
18-
--js node_modules/rxjs/_esm2015/internal/**.js
1923
--js node_modules/rxjs/operators/package.json
20-
--js node_modules/rxjs/_esm2015/operators/index.js
21-
22-
--js node_modules/@angular/compiler/package.json
23-
--js node_modules/@angular/compiler/fesm2015/compiler.js
24+
--js node_modules/rxjs/**.js
2425

2526
--js node_modules/@angular/core/package.json
2627
--js node_modules/@angular/core/fesm2015/core.js
27-
--js node_modules/@angular/core/src/testability/testability.externs.js
2828

2929
--js node_modules/@angular/common/package.json
3030
--js node_modules/@angular/common/fesm2015/common.js
3131

3232
--js node_modules/@angular/platform-browser/package.json
3333
--js node_modules/@angular/platform-browser/fesm2015/platform-browser.js
3434

35-
--module_resolution=node
36-
--package_json_entry_names es2015
37-
--process_common_js_modules
38-
3935
--js built/**.js
4036
--entry_point=built/src/main

integration/hello_world__closure/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
"version": "0.0.0",
44
"license": "MIT",
55
"dependencies": {
6-
"@angular/animations": "file:../../dist/packages-dist/animations",
76
"@angular/common": "file:../../dist/packages-dist/common",
87
"@angular/compiler": "file:../../dist/packages-dist/compiler",
98
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
109
"@angular/core": "file:../../dist/packages-dist/core",
10+
"@angular/elements": "file:../../dist/packages-dist/elements",
1111
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
12-
"@angular/platform-server": "file:../../dist/packages-dist/platform-server",
13-
"google-closure-compiler": "20180716.0.0",
1412
"rxjs": "file:../../node_modules/rxjs",
1513
"typescript": "file:../../node_modules/typescript",
14+
"tslib": "file:../../node_modules/tslib",
1615
"zone.js": "file:../../dist/zone.js-dist/zone.js"
1716
},
1817
"devDependencies": {
1918
"@types/jasmine": "file:../../node_modules/@types/jasmine",
2019
"@types/jasminewd2": "file:../../node_modules/@types/jasminewd2",
2120
"concurrently": "3.4.0",
21+
"google-closure-compiler": "file:../../node_modules/google-closure-compiler",
2222
"lite-server": "2.2.2",
2323
"protractor": "file:../../node_modules/protractor",
2424
"puppeteer": "file:../../node_modules/puppeteer",
@@ -29,7 +29,7 @@
2929
"**/webdriver-manager": "file:../../node_modules/webdriver-manager"
3030
},
3131
"scripts": {
32-
"closure": "java -jar node_modules/google-closure-compiler/compiler.jar --flagfile closure.conf",
32+
"closure": "google-closure-compiler --flagfile closure.conf",
3333
"build": "cd .",
3434
"test": "ngc && yarn run closure && concurrently \"yarn run serve\" \"yarn run protractor\" --kill-others --success first",
3535
"serve": "lite-server -c e2e/browser.config.json",

0 commit comments

Comments
 (0)