Skip to content
This repository was archived by the owner on Apr 26, 2022. It is now read-only.

Commit 85be372

Browse files
author
Corbin Crutchley
authored
Merge pull request #145 from zonzujiro/fixing-esm-support
adds support for ESM for plop
2 parents eab5b9e + 01e9231 commit 85be372

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/node-plop.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,10 @@ function nodePlop(plopfilePath = '', plopCfg = {}) {
190190
setPlopfilePath(plopfilePath);
191191
loadPackageJson();
192192

193-
require(path.join(plopfilePath, plopFileName))(plopfileApi, plopCfg);
193+
const plopFileExport = require(path.join(plopfilePath, plopFileName));
194+
const plop = typeof plopFileExport === 'function' ? plopFileExport : plopFileExport.default;
195+
196+
plop(plopfileApi, plopCfg);
194197
} else {
195198
setPlopfilePath(process.cwd());
196199
loadPackageJson();

0 commit comments

Comments
 (0)