mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
committed by
Martin Konicek
parent
147e9c3816
commit
49de9bd4d4
@@ -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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user