Skip to content

Commit 24e768f

Browse files
committed
Optimize React.createElement property accesses
1 parent e89f153 commit 24e768f

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

packages/babel-preset-react-app/create.js

+2
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ module.exports = function(api, opts, env) {
191191
// See https://github.com/facebook/create-react-app/issues/8445#issuecomment-588512250
192192
require('@babel/plugin-proposal-optional-chaining').default,
193193
require('@babel/plugin-proposal-nullish-coalescing-operator').default,
194+
isEnvProduction &&
195+
require('babel-plugin-transform-react-create-element').default,
194196
].filter(Boolean),
195197
overrides: [
196198
isFlowEnabled && {

packages/babel-preset-react-app/dependencies.js

+2
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ module.exports = function(api, opts) {
142142
absoluteRuntime: absoluteRuntimePath,
143143
},
144144
],
145+
isEnvProduction &&
146+
require('babel-plugin-transform-react-create-element').default,
145147
].filter(Boolean),
146148
};
147149
};

packages/babel-preset-react-app/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"@babel/preset-typescript": "7.9.0",
3636
"@babel/runtime": "7.9.0",
3737
"babel-plugin-macros": "2.8.0",
38+
"babel-plugin-transform-react-create-element": "^0.2.0",
3839
"babel-plugin-transform-react-remove-prop-types": "0.4.24"
3940
}
4041
}

0 commit comments

Comments
 (0)