From 9eb5151bd28d9a513d23f178d47e5a0cba1c3bc4 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. --- packager/transformer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packager/transformer.js b/packager/transformer.js index a77119312..0c0a98a92 100644 --- a/packager/transformer.js +++ b/packager/transformer.js @@ -35,6 +35,7 @@ function transform(srcTxt, filename, options) { 'react', 'regenerator', ], + plugins: ['node-env-inline'], sourceFileName: filename, sourceMaps: false, extra: options || {},