Support plugins that conform to ES6 modules

Summary:
ES6 modules export an object with a property called `default`. See Babel itself for how this is handled: b5b7e346a0
Closes https://github.com/facebook/react-native/pull/4513

Reviewed By: svcscm

Differential Revision: D2715512

Pulled By: mkonicek

fb-gh-sync-id: 40e5ea35adcdb66806a4895578d637cd72538619
This commit is contained in:
James Ide 2015-12-04 06:43:03 -08:00 committed by facebook-github-bot-5
parent 5ea0b333e7
commit b025a8d946
1 changed files with 1 additions and 0 deletions

View File

@ -48,6 +48,7 @@ function transform(src, filename, options) {
// Only resolve the plugin if it's a string reference.
if (typeof plugin[0] === 'string') {
plugin[0] = require(`babel-plugin-${plugin[0]}`);
plugin[0] = plugin[0].__esModule ? plugin[0].default : plugin[0];
}
return plugin;
});