Skip to content

Commit 51eceec

Browse files
committed
feat: esm support
1 parent 96380ea commit 51eceec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ function postinstall(pkgdir) {
100100
var hookFileName = generateHookName(pkg, hook);
101101
var hookPath = path.join(hookDir, hookFileName);
102102

103-
var trampoline = util.format('%srequire("%s/%s");', hook.inject ? 'module.exports = ' : '', pkg.name, hook.script);
103+
var trampoline = `import hooks from "${pkg.name}/${hook.script}";
104+
105+
export default hooks;`
104106

105107
fs.writeFileSync(hookPath, trampoline + os.EOL);
106108
});

0 commit comments

Comments
 (0)