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
Fix static/proto initializers when there aren't class fields #14335
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/51422/ |
313330f
to
7a76b0b
Compare
if (kind !== 0 /* FIELD */) { | ||
staticInitializers = staticInitializers || []; | ||
initializers = staticInitializers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, but this probably produces a smaller output: initializers = staticInitializers = staticInitializers || []
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah no it's ok, the minifier step already produces this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initializers = staticInitializers = staticInitializers || []
This is the exact output in helpers-generated
by terser, so I don't bother to manually minify here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, let's see if the new CI check already catches some missing files 😬
5f57e57
to
965a1a6
Compare
:) It's work's now. |
I slightly updated the PR title so that it fits in a commit message even with |
The helper behaviour is now strictly aligned with the transformer:
babel/packages/babel-plugin-proposal-decorators/src/transformer-2021-12.ts
Lines 734 to 740 in 0b29359
Also added a script per #14334 (comment). Here is an an example output when we have uncommitted changes after build
/cc @wvq Please try if this PR fixes the issues you found when using decorators. Thank you!