From 49de9bd4d418d71046ed07ecb40679ebdd1bc89a Mon Sep 17 00:00:00 2001 From: James Ide Date: Fri, 4 Dec 2015 06:43:03 -0800 Subject: [PATCH] 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: https://github.com/babel/babel/commit/b5b7e346a04c99da8793e2c65cc3b3c7c720253d Closes https://github.com/facebook/react-native/pull/4513 Reviewed By: svcscm Differential Revision: D2715512 Pulled By: mkonicek fb-gh-sync-id: 40e5ea35adcdb66806a4895578d637cd72538619 --- packager/transformer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packager/transformer.js b/packager/transformer.js index 4700407c93681b..70dde7702c2887 100644 --- a/packager/transformer.js +++ b/packager/transformer.js @@ -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; });