Skip to content

Commit

Permalink
metro-bundler: tweak babel-register callsite
Browse files Browse the repository at this point in the history
Summary:
This fixes facebook/react-native#14530 on my local repro. The reason the original problem appears is because when requiring the preset itself, what I think is a bug in babel-register kicks in and it starts transforming the presets themselves. That fails because these preset don't actually have the correct transforms plugins installed/specified in their `package.json` (they do it at prepublish time).
Closes #21

Reviewed By: cpojer

Differential Revision: D5380795

Pulled By: jeanlauliac

fbshipit-source-id: 023fd6b36dc7ebd26961878edd71d423ea9856b5
  • Loading branch information
Jean Lauliac authored and facebook-github-bot committed Jul 7, 2017
1 parent 7450484 commit 029483d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/metro-bundler/src/babelRegisterOnly.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ require('./setupNodePolyfills');
var _only = [];

function registerOnly(onlyList) {
// This prevents `babel-register` from transforming the code of the
// plugins/presets that we are require-ing themselves before setting up the
// actual config.
require('babel-register')({only: [], babelrc: false});
require('babel-register')(config(onlyList));
}

Expand Down

0 comments on commit 029483d

Please sign in to comment.