Optimization build moves private class fields before the super() call for third party dependencies #22486
Closed
2 of 15 tasks
Labels
area: @angular-devkit/build-angular
freq1: low
Only reported by a handful of users who observe it rarely
severity3: broken
type: bug/fix
Milestone
🐞 Bug report
Command (mark with an
x
)Is this a regression?
I don't think so
Description
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
npm install [email protected]
)import 'scrollable-component';
inside yourmain.ts
)ng build
orng serve --configuration production
,optimization
should be set totrue
inside yourangular.json
)(here is the third party imported file)
🔥 Exception or Error
🌍 Your Environment
Anything else relevant?
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 theproduction
configuration.From what I can understand, something like this happens:
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).
The text was updated successfully, but these errors were encountered: