Enable `?.` plugins in RN
Summary: Enable the optional chaining operator plugins for React Native. Reviewed By: rafeca Differential Revision: D7828244 fbshipit-source-id: 659a8a82ff6d656a5cb2f33377d85b668b93a9ea
This commit is contained in:
parent
9927d20927
commit
aa6f394c42
|
@ -52,6 +52,7 @@ const exponentiationOperator = [
|
|||
];
|
||||
const objectAssign = [require('@babel/plugin-transform-object-assign')];
|
||||
const objectRestSpread = [require('@babel/plugin-proposal-object-rest-spread')];
|
||||
const optionalChaining = [require('@babel/plugin-proposal-optional-chaining')];
|
||||
const reactDisplayName = [
|
||||
require('@babel/plugin-transform-react-display-name'),
|
||||
];
|
||||
|
@ -98,6 +99,9 @@ const getPreset = (src, options) => {
|
|||
) {
|
||||
extraPlugins.push(reactDisplayName);
|
||||
}
|
||||
if (isNull || src.indexOf('?.') !== -1) {
|
||||
extraPlugins.push(optionalChaining);
|
||||
}
|
||||
|
||||
if (options && options.dev) {
|
||||
extraPlugins.push(reactJsxSource);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
"dependencies": {
|
||||
"@babel/plugin-proposal-class-properties": "7.0.0-beta.40",
|
||||
"@babel/plugin-proposal-object-rest-spread": "7.0.0-beta.40",
|
||||
"@babel/plugin-proposal-optional-chaining": "7.0.0-beta.40",
|
||||
"@babel/plugin-transform-arrow-functions": "7.0.0-beta.40",
|
||||
"@babel/plugin-transform-block-scoping": "7.0.0-beta.40",
|
||||
"@babel/plugin-transform-classes": "7.0.0-beta.40",
|
||||
|
|
Loading…
Reference in New Issue