From cc01b6daf4381f6fac4cf77be2594f6f1f3a6659 Mon Sep 17 00:00:00 2001 From: Amjad Masad Date: Sat, 15 Aug 2015 12:21:50 -0700 Subject: [PATCH] [react-native] Set NODE_ENV and use node-env-inline plugin Summary: This sets NODE_ENV based on the value of the `dev` option when bundling the apps. This would then be inlined by the node-env-inline babel plugin. And finally -- if unreachable -- will be dead-code-eliminated by uglify. This is not used in development because we set NODE_ENV to the value of __DEV__, which can be switched via a query param. However, the plugin has minimal overhead and to avoid complexity in the transformers I just enabled it by default. --- transformer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/transformer.js b/transformer.js index a7711931..0c0a98a9 100644 --- a/transformer.js +++ b/transformer.js @@ -35,6 +35,7 @@ function transform(srcTxt, filename, options) { 'react', 'regenerator', ], + plugins: ['node-env-inline'], sourceFileName: filename, sourceMaps: false, extra: options || {},