Skip to content

Commit 269b420

Browse files
feat: Dual Package to support ESM also, not just CJS
1 parent d2c7544 commit 269b420

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

esm/wrapper.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { createRequire } from "node:module";
2+
const require = createRequire(import.meta.url);
3+
const nativeModule = require("../index.js");
4+
export default nativeModule;
5+
// Re-export all named exports
6+
export * from "../index.js";

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"types": "./dist/src/index.d.ts"
3232
},
3333
"./native": {
34-
"import": "./index.js",
34+
"import": "./esm/wrapper.js",
35+
"require": "./index.js",
3536
"types": "./index.d.ts"
3637
}
3738
},

0 commit comments

Comments
 (0)