Skip to content

Commit

Permalink
fix(core): disabble tsickle pass when producing APF packages
Browse files Browse the repository at this point in the history
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 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 are rethinking our strategy to make thAngular 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 reenable
the fixed version.

BREAKING CHANGE: Angular npm packages no longer contain jsdoc comments to support optimization by Closure Compiler

The support for Closure compiler in Angular packages has been broken for quite
some time. As of TS3.9 Closure is unusable with the JavaScript emit.
Please follow microsoft/TypeScript#38374 for
further developments.

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 vesion we publish on npm which is primarily
optimized for Webpack/Rollup + Terser build pipeline.
  • Loading branch information
IgorMinar committed May 20, 2020
1 parent 59e7203 commit 96c150b
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 202 deletions.
2 changes: 1 addition & 1 deletion goldens/size-tracking/aio-payloads.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"master": {
"uncompressed": {
"runtime-es2015": 3097,
"main-es2015": 430367,
"main-es2015": 429710,
"polyfills-es2015": 52195
}
}
Expand Down
9 changes: 7 additions & 2 deletions packages/bazel/src/ngc-wrapped/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,13 @@ export function compile({
}

if (!bazelOpts.es5Mode) {
compilerOpts.annotateForClosureCompiler = true;
compilerOpts.annotationsAs = 'static fields';
if (bazelOpts.workspaceName === 'google3') {
compilerOpts.annotateForClosureCompiler = true;
compilerOpts.annotationsAs = 'static fields';
} else {
compilerOpts.annotateForClosureCompiler = false;
compilerOpts.annotationsAs = 'decorators';
}
}

// Detect from compilerOpts whether the entrypoint is being invoked in Ivy mode.
Expand Down
Loading

0 comments on commit 96c150b

Please sign in to comment.