From 4978855d72aeaad20aa1e72e78cc07ef6acbd72a Mon Sep 17 00:00:00 2001 From: yiminghe Date: Sat, 26 Sep 2015 15:48:28 -0700 Subject: [PATCH] support es6.constants by default. Fixes #2932 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: In javascriptcore(ios9), this code will run as expected(output 0 1): ```js for(let i=0; i<2; i++) { const data = i; console.log(data); } ``` But when debug in chrome, the above code will fail without `use strict` prologue (if you add prologue, rn will fail with red screen `Const declarations are not supported in strict mode`): https://code.google.com/p/v8/issues/detail?id=4432. So it's better to transpile contant by default. Closes https://github.com/facebook/react-native/pull/2955 Reviewed By: @​svcscm Differential Revision: D2483398 Pulled By: @vjeux --- packager/react-packager/.babelrc | 3 +-- packager/transformer.js | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packager/react-packager/.babelrc b/packager/react-packager/.babelrc index 6409e69a8..45e1d6e9f 100644 --- a/packager/react-packager/.babelrc +++ b/packager/react-packager/.babelrc @@ -6,9 +6,8 @@ "whitelist": [ "es6.arrowFunctions", "es6.blockScoping", - // This is the only place where we differ from transformer.js - "es6.constants", "es6.classes", + "es6.constants", "es6.destructuring", "es6.parameters", "es6.properties.computed", diff --git a/packager/transformer.js b/packager/transformer.js index 033ad5799..59a1ea44f 100644 --- a/packager/transformer.js +++ b/packager/transformer.js @@ -35,6 +35,7 @@ function transform(src, filename, options) { 'es6.arrowFunctions', 'es6.blockScoping', 'es6.classes', + 'es6.constants', 'es6.destructuring', 'es6.parameters', 'es6.properties.computed',