Skip to content

Commit 6cac6a6

Browse files
committed
fix: correct output from build script to be ESM
1 parent 12b8a00 commit 6cac6a6

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

scripts/build.mjs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,13 @@ async function main() {
3535

3636
const entryPoints = ["./pkg/dist-src/index.js"];
3737

38-
// Build a CJS Node.js bundle
38+
// Build a bundle
3939
await esbuild.build({
4040
entryPoints,
41-
outdir: "pkg/dist-node",
41+
outdir: "pkg/dist-bundle",
4242
bundle: true,
43-
platform: "node",
44-
target: "node14",
45-
format: "cjs",
43+
platform: "neutral",
44+
format: "esm",
4645
...sharedOptions,
4746
});
4847

@@ -63,9 +62,12 @@ async function main() {
6362
{
6463
...pkg,
6564
files: ["dist-*/**", "bin/**"],
66-
main: "dist-node/index.js",
67-
types: "dist-types/index.d.ts",
68-
module: "dist-src/index.js",
65+
exports: {
66+
".": {
67+
types: "./dist-types/index.d.ts",
68+
import: "./dist-bundle/index.js",
69+
},
70+
},
6971
sideEffects: false,
7072
},
7173
null,

0 commit comments

Comments
 (0)