From 113e046444e090e38f89574620210ba86b711fed Mon Sep 17 00:00:00 2001 From: James Ide Date: Wed, 26 Jul 2017 15:28:20 -0700 Subject: [PATCH] Control whether Metro tells Babel to lookup .babelrc files Summary: This adds support to RN's configuration file to let people turn off Babel's behavior of looking up .babelrc files. Most of the support for this feature is in Metro (https://github.com/facebook/metro-bundler/pull/31). Closes https://github.com/facebook/react-native/pull/15136 Differential Revision: D5483241 Pulled By: jeanlauliac fbshipit-source-id: c78096c1574c9f844c9f34aff73e6f97cb0b5e45 --- local-cli/server/runServer.js | 1 + local-cli/util/Config.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/local-cli/server/runServer.js b/local-cli/server/runServer.js index 470a4519ad..8d9f5f7e4e 100644 --- a/local-cli/server/runServer.js +++ b/local-cli/server/runServer.js @@ -152,6 +152,7 @@ function getPackagerServer(args, config) { assetRegistryPath: ASSET_REGISTRY_PATH, blacklistRE: config.getBlacklistRE(), cacheVersion: '3', + enableBabelRCLookup: config.getEnableBabelRCLookup(), extraNodeModules: config.extraNodeModules, getPolyfills: config.getPolyfills, getTransformOptions: config.getTransformOptions, diff --git a/local-cli/util/Config.js b/local-cli/util/Config.js index 1a0dd4fe15..6a74007e69 100644 --- a/local-cli/util/Config.js +++ b/local-cli/util/Config.js @@ -49,6 +49,13 @@ export type ConfigT = { */ getBlacklistRE(): RegExp, + /** + * Specify whether or not to enable Babel's behavior for looking up .babelrc + * files. If false, only the .babelrc file (if one exists) in the main project + * root is used. + */ + getEnableBabelRCLookup(): boolean, + /** * Specify any additional polyfill modules that should be processed * before regular module loading. @@ -164,6 +171,7 @@ const Config = { extraNodeModules: Object.create(null), getAssetExts: () => [], getBlacklistRE: () => blacklist(), + getEnableBabelRCLookup: () => true, getPlatforms: () => [], getPolyfillModuleNames: () => [], getProjectRoots: () => {