From 3d61451c798799b152aa47bdd818d4c81b398c1d Mon Sep 17 00:00:00 2001 From: Ivan Zotov Date: Wed, 16 Aug 2017 21:07:22 +0300 Subject: [PATCH] Fix TransformError issue for babel-preset-react-native --- babel-preset/configs/main.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/babel-preset/configs/main.js b/babel-preset/configs/main.js index c2f4d483efdacb..df0d581359f4e2 100644 --- a/babel-preset/configs/main.js +++ b/babel-preset/configs/main.js @@ -13,13 +13,7 @@ var resolvePlugins = require('../lib/resolvePlugins'); const getPreset = (src, options) => { - const plugins = []; - const isNull = src === null || src === undefined; - const hasClass = isNull || src.indexOf('class') !== -1; - const hasForOf = - isNull || (src.indexOf('for') !== -1 && src.indexOf('of') !== -1); - - plugins.push( + const plugins = [ 'syntax-class-properties', 'syntax-trailing-function-commas', 'transform-class-properties', @@ -38,7 +32,11 @@ const getPreset = (src, options) => { 'transform-es2015-modules-commonjs', {strict: false, allowTopLevelThis: true}, ], - ); + ]; + const isNull = src === null || src === undefined; + const hasClass = isNull || src.indexOf('class') !== -1; + const hasForOf = + isNull || (src.indexOf('for') !== -1 && src.indexOf('of') !== -1); if (isNull || src.indexOf('async') !== -1 || src.indexOf('await') !== -1) { plugins.push('syntax-async-functions');