From 36893ecfa06797a18f4ae892905101d5dec31e26 Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Mon, 21 Mar 2016 06:23:15 -0700 Subject: [PATCH] Enable strict mode for transform-es2015-modules-commonjs Summary:Since #5422 react-native works with strict mode modules but the transform was not updated since Facebook has some non strict mode compatible internal modules. Now that #5214 has landed and it is easy to change the babel config I think we should enable it by default to make es2015 modules spec compliant. Someone at Facebook will have to make the internal changes necessary to disable strict mode modules for their projects that use non strict mode compatible modules by including a .babelrc file with ``` json { "presets": [ "react-native" ], "plugins": [ ["transform-es2015-modules-commonjs", { "strict": false, "allowTopLevelThis": true }] ] } ``` before merging this. We might also want to mention this in the breaking change section for the next release. Closes https://github.com/facebook/react-native/pull/5796 Differential Revision: D3075802 fb-gh-sync-id: e807b67401107e1e944db38453e254025ce0a6c7 shipit-source-id: e807b67401107e1e944db38453e254025ce0a6c7 --- babel-preset/configs/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/babel-preset/configs/main.js b/babel-preset/configs/main.js index 3322812bd07ca5..da6f64efdbf04b 100644 --- a/babel-preset/configs/main.js +++ b/babel-preset/configs/main.js @@ -24,7 +24,7 @@ module.exports = { 'transform-es2015-computed-properties', 'transform-es2015-constants', 'transform-es2015-destructuring', - ['transform-es2015-modules-commonjs', { strict: false, allowTopLevelThis: true }], + ['transform-es2015-modules-commonjs', { allowTopLevelThis: true }], 'transform-es2015-parameters', 'transform-es2015-shorthand-properties', 'transform-es2015-spread',