Skip to content

Commit bf735d1

Browse files
committed
fix: require of plugin that exports ES module
Transpiled ES modules don't export the default export directly as CommonJS modules, they always export an object and the default export is under the key "default" in this object.
1 parent 223f29e commit bf735d1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/cli.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ const read = file => new Promise(resolve => fs.readFile(file, 'utf8', (error, da
6060
resolve(data);
6161
}));
6262

63+
const interopRequire = object => object && object.__esModule ? object.default : object;
64+
6365
const getPlugins = config => Object.keys(config.plugins || {})
64-
.map(plugin => require(plugin)(config.plugins[plugin]));
66+
.map(plugin => interopRequire(require(plugin))(config.plugins[plugin]));
6567

6668
const config = cfgResolve(cli);
6769

0 commit comments

Comments
 (0)