Skip to content

Commit

Permalink
[global] fix transform-runtime helpers import (#545)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bbutkov committed Feb 21, 2023
1 parent f1a7368 commit c04f767
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/babel-preset-ui/.babelrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ module.exports = function (babel, opts = {}) {
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-proposal-class-properties',
'babel-plugin-preval',
'@babel/plugin-transform-runtime',
[
'@babel/plugin-transform-runtime', {
version: require('@babel/runtime/package.json').version,
}
],
[
'@semcore/babel-plugin-recharts',
{
Expand Down

0 comments on commit c04f767

Please sign in to comment.