Fix static/proto initializers when there aren't class fields#14335
Fix static/proto initializers when there aren't class fields#14335nicolo-ribaudo merged 3 commits intobabel:mainfrom
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.
Nit, but this probably produces a smaller output: initializers = staticInitializers = staticInitializers || [].
There was a problem hiding this comment.
Ah no it's ok, the minifier step already produces this code.
There was a problem hiding this comment.
initializers = staticInitializers = staticInitializers || []
This is the exact output in helpers-generated by terser, so I don't bother to manually minify here.
nicolo-ribaudo
left a comment
There was a problem hiding this comment.
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!