Skip to content

Commit b704844

Browse files
committed
Build react-native-web using @babel/runtime
Share babel helpers across files. Reduces flat bundle size by 30K minified and 3K gzipped.
1 parent f810954 commit b704844

File tree

4 files changed

+6904
-6749
lines changed

4 files changed

+6904
-6749
lines changed

configs/babel.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ module.exports = function (api) {
4343
['babel-plugin-transform-react-remove-prop-types', { mode: 'wrap' }],
4444
['@babel/plugin-proposal-class-properties', { loose: true }],
4545
['@babel/plugin-proposal-object-rest-spread', { useBuiltIns: true }],
46-
'@babel/plugin-proposal-nullish-coalescing-operator'
46+
'@babel/plugin-proposal-nullish-coalescing-operator',
47+
[
48+
'@babel/plugin-transform-runtime',
49+
{
50+
version: '7.18.6'
51+
}
52+
]
4753
].concat(modules ? ['babel-plugin-add-module-exports'] : [])
4854
};
4955
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"@babel/plugin-proposal-class-properties": "^7.12.13",
3636
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.13",
3737
"@babel/plugin-proposal-object-rest-spread": "^7.12.13",
38-
"@babel/plugin-transform-runtime": "^7.12.15",
38+
"@babel/plugin-transform-runtime": "^7.18.6",
3939
"@babel/preset-env": "^7.12.13",
4040
"@babel/preset-flow": "^7.12.13",
4141
"@babel/preset-react": "^7.12.13",

packages/react-native-web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"!**/__tests__"
1515
],
1616
"dependencies": {
17+
"@babel/runtime": "^7.18.6",
1718
"create-react-class": "^15.7.0",
1819
"fbjs": "^3.0.0",
1920
"inline-style-prefixer": "^6.0.0",

0 commit comments

Comments
 (0)