Skip to content

Commit

Permalink
Default enableBabelRCLookup (recursive) to false
Browse files Browse the repository at this point in the history
Summary:
This is a breaking change that tells Metro to look at only the project's .babelrc file. Previously it would look at .babelrc files under node_modules and would run into issues because it didn't have the version of Babel nor the plugins/presets that `node_modules/randompackage/.babelrc` wanted. So as a workaround, people would write a postinstall step that deletes `node_modules/**/.babelrc`, which worked well. This flag (`getEnableBabelRCLookup = false`) has the same effect and hopefully fixes one source of cryptic bugs people run into.

To use the old behavior, create a config file named `rn-cli.config.js` with:
```js
module.exports = {
  getEnableBabelRCLookup() {
    return true;
  },
};
```

Go under node_modules, modify a used module to have a dummy .babelrc (`{"plugins": ["dummy"]}`) and ensure the JS bundle still loads.
Closes #15860

Differential Revision: D5798264

Pulled By: jeanlauliac

fbshipit-source-id: ce368b1d5671cc6c6261cbe3c39e61c9401fe37a
  • Loading branch information
ide authored and facebook-github-bot committed Sep 11, 2017
1 parent c55fae1 commit 023ac57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion local-cli/util/Config.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ const Config = {
extraNodeModules: Object.create(null), extraNodeModules: Object.create(null),
getAssetExts: () => [], getAssetExts: () => [],
getBlacklistRE: () => blacklist(), getBlacklistRE: () => blacklist(),
getEnableBabelRCLookup: () => true, getEnableBabelRCLookup: () => false,

This comment has been minimized.

Copy link
@valeedamillsaps

valeedamillsaps Nov 20, 2017

I need codes

getPlatforms: () => [], getPlatforms: () => [],
getPolyfillModuleNames: () => [], getPolyfillModuleNames: () => [],
getProjectRoots: () => { getProjectRoots: () => {
Expand Down

0 comments on commit 023ac57

Please sign in to comment.