From ef794198e9145d78329fe3e6ca1cd7e408b954fa Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Sun, 25 Sep 2016 11:22:42 -0700 Subject: [PATCH] Allow presets to be ES6 exports. --- .../src/transformation/file/options/option-manager.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/babel-core/src/transformation/file/options/option-manager.js b/packages/babel-core/src/transformation/file/options/option-manager.js index ad4fbf4ed9..808f8947f4 100644 --- a/packages/babel-core/src/transformation/file/options/option-manager.js +++ b/packages/babel-core/src/transformation/file/options/option-manager.js @@ -281,6 +281,9 @@ export default class OptionManager { val = require(presetLoc); } + // If the imported preset is a transpiled ES2015 module, grab the default export. + if (typeof val === "object" && val.__esModule) val = val.default; + // For compatibility with babel-core < 6.13.x, allow presets to export an object with a // a 'buildPreset' function that will return the preset itself, while still exporting a // simple object (rather than a function), for supporting old Babel versions.