mirror of
https://github.com/status-im/metro.git
synced 2025-01-22 08:58:55 +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: 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:
parent
5ea0b333e7
commit
b025a8d946
@ -48,6 +48,7 @@ function transform(src, filename, options) {
|
|||||||
// Only resolve the plugin if it's a string reference.
|
// Only resolve the plugin if it's a string reference.
|
||||||
if (typeof plugin[0] === 'string') {
|
if (typeof plugin[0] === 'string') {
|
||||||
plugin[0] = require(`babel-plugin-${plugin[0]}`);
|
plugin[0] = require(`babel-plugin-${plugin[0]}`);
|
||||||
|
plugin[0] = plugin[0].__esModule ? plugin[0].default : plugin[0];
|
||||||
}
|
}
|
||||||
return plugin;
|
return plugin;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user