Skip to content

Commit 2030ee1

Browse files
authoredFeb 20, 2020
Fix optional chaining and nullish coalescing support (#8526)
1 parent 038e6fa commit 2030ee1

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed
 

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

+6
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ module.exports = function(api, opts, env) {
185185
removeImport: true,
186186
},
187187
],
188+
// Optional chaining and nullish coalescing are supported in @babel/preset-env,
189+
// but not yet supported in webpack due to support missing from acorn.
190+
// These can be removed once webpack has support.
191+
// See https://github.com/facebook/create-react-app/issues/8445#issuecomment-588512250
192+
require('@babel/plugin-proposal-optional-chaining').default,
193+
require('@babel/plugin-proposal-nullish-coalescing-operator').default,
188194
].filter(Boolean),
189195
overrides: [
190196
isFlowEnabled && {

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

+2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
"@babel/core": "7.8.4",
2525
"@babel/plugin-proposal-class-properties": "7.8.3",
2626
"@babel/plugin-proposal-decorators": "7.8.3",
27+
"@babel/plugin-proposal-nullish-coalescing-operator": "7.8.3",
2728
"@babel/plugin-proposal-numeric-separator": "7.8.3",
29+
"@babel/plugin-proposal-optional-chaining": "7.8.3",
2830
"@babel/plugin-transform-flow-strip-types": "7.8.3",
2931
"@babel/plugin-transform-react-display-name": "7.8.3",
3032
"@babel/plugin-transform-runtime": "7.8.3",

0 commit comments

Comments
 (0)
Please sign in to comment.