You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Optimization build moves private class fields before the super() call for third party dependencies #22486
When you import a third party dependecy that uses private class fields (Native private class features), they end up being inserted into the constructor before the super() call.
🔬 Minimal Reproduction
Create a new Angular project
Add a third party library that uses private class fields ( npm install [email protected])
Import the library (import 'scrollable-component'; inside your main.ts)
Build the project (ng build or ng serve --configuration production, optimization should be set to true inside your angular.json)
The bug only occurs when your build configuration contains the "optimization": true (or does not contain the "optimization": false) rule, which is the default for the production configuration.
From what I can understand, something like this happens:
// Before optimizationclassTestextendsHTMLElement{
#privateField;constructor(){super();}}
// After optimizationclassTestextendsHTMLElement{constructor(){__definePrivateField(this,privateField);super();}}
I found this issue evanw/esbuild#1918 which may be related and tried several options in my tsconfig.json, like:
"target": "esnext"
"module": "esnext"
but I haven't been able to make it work (the problem also occurs with private class methods).
Activity
fix(@angular-devkit/build-angular): support ESNext as target for Java…
fix(@angular-devkit/build-angular): support ESNext as target for Java…
angular-automatic-lock-bot commentedon Feb 16, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.