Skip to content
Permalink
Browse files

Enable `?.` plugins in RN

Summary: Enable the optional chaining operator plugins for React Native.

Reviewed By: rafeca

Differential Revision: D7828244

fbshipit-source-id: 659a8a82ff6d656a5cb2f33377d85b668b93a9ea
  • Loading branch information...
Peter van der Zee authored and facebook-github-bot committed May 2, 2018
1 parent 9927d20 commit aa6f394c4236e5a4998c3be8ed61ec1bab950775
Showing with 5 additions and 0 deletions.
  1. +4 −0 babel-preset/configs/main.js
  2. +1 −0 babel-preset/package.json
@@ -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",

0 comments on commit aa6f394

Please sign in to comment.
You can’t perform that action at this time.