Allow presets to be ES6 exports.

This commit is contained in:
Logan Smyth
2016-09-25 11:22:42 -07:00
parent e16a1657ab
commit ef794198e9

View File

@@ -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.