Skip to content
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

feat(v2): explicit babel/runtime version #2111

Merged
merged 1 commit into from Dec 10, 2019
Merged

feat(v2): explicit babel/runtime version #2111

merged 1 commit into from Dec 10, 2019

Conversation

endiliey
Copy link
Contributor

@endiliey endiliey commented Dec 10, 2019

Motivation

See babel/babel#10261 and babel/babel#10261 (comment)

By default transform-runtime assumes that @babel/runtime@7.0.0 is installed. If you have later versions of @babel/runtime but did not specify version, transform-runtime will only use the helper from 7.0.0 resulting in larger bundle size.

In this case, it will assume you are using babel/helpers 7.0.0-beta.0, which means every helper introduced later than 7.0.0-beta.0 will be inlined instead of require.

Better to be explicit

Inspired from facebook/create-react-app#7726

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

  • Netlify should all pass
  • CI

@endiliey endiliey added the pr: maintenance This PR does not produce any behavior differences to end users when upgrading. label Dec 10, 2019
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Dec 10, 2019
@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit ae31935

https://deploy-preview-2111--docusaurus-2.netlify.com

@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-preview ready!

Built with commit ae31935

https://deploy-preview-2111--docusaurus-preview.netlify.com

@yangshun yangshun merged commit 6db2989 into master Dec 10, 2019
@endiliey endiliey deleted the endi/babel branch December 13, 2019 08:54
lsroman pushed a commit to semrush/intergalactic that referenced this pull request Feb 21, 2023
Fixing the problem of incorrect helper imports

## Description + Motivation and Context

Due to a bug in babel-runtime, not all helpers are imported correctly,
instead, some of them are simply inlined INTO EVERY module, which
affects code size and performance degradation

These are links to a detailed description of the problem

babel/babel#10334
babel/babel#10261
facebook/docusaurus#2111


This fix will definitely improve code size and performance, but to make
it even better, you need to get rid of **babel-runtime-helper** and use
**@babel/preset-env** with properly configured **browserslist**, then
native method will be used for the same code spread

## How has this been tested?

All tests passed, build does not crash, website works locally

## Screenshots (if appropriate):

**Before:**
<img width="897" alt="before-core"
src="https://user-images.githubusercontent.com/12624143/220091398-99e0fe54-7e46-414d-ae20-7f2221069909.png">

**After:**
<img width="800" alt="after-core"
src="https://user-images.githubusercontent.com/12624143/220091435-6b364fce-513b-4b53-894a-6caadac2593b.png">


## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: maintenance This PR does not produce any behavior differences to end users when upgrading.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants