-
Notifications
You must be signed in to change notification settings - Fork 12k
buildOptimizer deleted some code from a property setter in a component that came from an ng-packagr library #14084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
For those looking for the TL;DR... Here's the property setter before
And here's the after:
The two lines it dropped are very important, and not having them breaks my app. |
Hi, I just had a quick look at this, and it seems that BuildOptimizer/Terser are dropping the code mentioned above, when the ES2015 JS code is not emitted by Tsickle but rather NGC directly. Note: Tsickle is not enabled by default in CLI libraries, nor is in ng-packagr version 5. NGC + Tsickle
NGC - Tsickle
Following a convo with @filipesilva, he thinks that the below might be the cause of such issue:
|
… expressions When we removed tsickle from the library compilation pipeline the emitted JS changes for Classes. With tsc a class can be of kind CallExpression because of this syntax ``` let Foo = class Foo { constructor() { this.isExpandedChange = new EventEmitter(); } set isExpanded(value) { this.isExpandedChange.emit(value); } }; ``` In such case we shall not add `/*@__PURE__*/` inside this class Fixes #14084
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command (mark with an
x
)Is this a regression?
Unknown.
Description
The build optimizer seems to have stripped out some important code. Here's my original TypeScript (template and styles ommitted for brevity):
And here's the code that gets generated with
buildOptimizer: true
(un-minified, but otherwise presented as-is):Notice the
set isExpanded
property setterThis code is in a library that gets packaged via
ng-packagr
version 5.0.1. However, here is the code thatng-packagr
generates:The correct code is generated if
buildOptimizer: false
is used in myangular.json
.🌍 Your Environment
The text was updated successfully, but these errors were encountered: