Skip to content

Commit

Permalink
Control whether Metro tells Babel to lookup .babelrc files
Browse files Browse the repository at this point in the history
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 (facebook/metro#31).
Closes #15136

Differential Revision: D5483241

Pulled By: jeanlauliac

fbshipit-source-id: c78096c1574c9f844c9f34aff73e6f97cb0b5e45
  • Loading branch information
ide committed Jul 26, 2017
1 parent 07de855 commit 9194b9d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions local-cli/server/runServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ function getPackagerServer(args, config) {
assetExts: defaultAssetExts.concat(args.assetExts),
blacklistRE: config.getBlacklistRE(),
cacheVersion: '3',
enableBabelRCLookup: config.getEnableBabelRCLookup(),
extraNodeModules: config.extraNodeModules,
getTransformOptions: config.getTransformOptions,
hasteImpl: config.hasteImpl,
Expand Down
8 changes: 8 additions & 0 deletions local-cli/util/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -158,6 +165,7 @@ const Config = {
extraNodeModules: Object.create(null),
getAssetExts: () => [],
getBlacklistRE: () => blacklist(),
getEnableBabelRCLookup: () => true,
getPlatforms: () => [],
getPolyfillModuleNames: () => [],
getProjectRoots: () => {
Expand Down

0 comments on commit 9194b9d

Please sign in to comment.