Skip to content

Avoid IIFE for single-expression class static blocks#14275

Merged
nicolo-ribaudo merged 1 commit intobabel:mainfrom
nicolo-ribaudo:no-iife-single-expr-static-block
Feb 18, 2022
Merged

Avoid IIFE for single-expression class static blocks#14275
nicolo-ribaudo merged 1 commit intobabel:mainfrom
nicolo-ribaudo:no-iife-single-expr-static-block

Conversation

@nicolo-ribaudo
Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo commented Feb 15, 2022

Q                       A
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

I noticed that static blocks containing a single expression are quite common, so this PR avoids the IIFE when compiling them. Note that this optimization only affects who is not using a minifier, because minifiers can already easily unwrap IIFEs.

@nicolo-ribaudo nicolo-ribaudo added Spec: Class Static Block PR: Output optimization 🔬 A type of pull request used for our changelog categories labels Feb 15, 2022
@babel-bot
Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/51304/

@nicolo-ribaudo nicolo-ribaudo merged commit 1937284 into babel:main Feb 18, 2022
@nicolo-ribaudo nicolo-ribaudo deleted the no-iife-single-expr-static-block branch February 18, 2022 09:34
@github-actions github-actions Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 21, 2022
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Output optimization 🔬 A type of pull request used for our changelog categories Spec: Class Static Block

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants