Skip to content

optim: specify version in @babel/plugin-transform-runtime #80

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

Merged
merged 1 commit into from
May 18, 2022

Conversation

agilgur5
Copy link
Owner

Summary

Specify a version in @babel/plugin-transform-runtime's config to further optimize the output with newer helpers.

Details

Misc

Noticed that this was a field when stumbling upon the @babel/plugin-transform-runtime options in the Babel docs.
Tested this simultaneously with #79 as they both affect the output

- the default is 7.0.0, but we are on a newer version, so we can use
  newer / more optimized helpers
  - `createSuper` now seems to be used, which required 7.9.0:
    https://github.com/babel/babel/blob/9199565fa08d840c8f1cc86c1b22be119b538f2f/packages/babel-helpers/src/helpers.ts#L624
    - this seems to replace the `possibleConstructorReturn` and
      `getPrototypeOf` helpers

- roughly ~6% minified size decrease as a result!

- change babel.config.js's caching to include @babel/runtime's version
  since we would need to rebuild if it changes
@agilgur5 agilgur5 added the kind: optimization Performance, space, size, etc improvement label May 18, 2022
@codecov

This comment was marked as resolved.

Copy link
Owner Author

@agilgur5 agilgur5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tests pass here too and, similarly to #79, I tested the dist build locally against the example as well.

@agilgur5 agilgur5 merged commit 3db849f into main May 18, 2022
@agilgur5 agilgur5 deleted the optim-babel-runtime-version branch May 18, 2022 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: optimization Performance, space, size, etc improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant