Skip to content

Commit

Permalink
fix(build): correctly output ESM (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy1339 authored Feb 25, 2024
1 parent 177aacf commit 8d38d31
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function main() {
bundle: true,
platform: "node",
target: "node18",
format: "cjs",
format: "esm",
...sharedOptions,
}),
// Build an ESM browser bundle
Expand Down Expand Up @@ -74,10 +74,22 @@ async function main() {
{
...pkg,
files: ["dist-*/**", "bin/**"],
main: "dist-node/index.js",
browser: "dist-web/index.js",
types: "dist-types/index.d.ts",
module: "dist-src/index.js",
exports: {
".": {
node: {
types: "./dist-types/index.d.ts",
import: "./dist-node/index.js",
},
browser: {
types: "./dist-types/web.d.ts",
import: "./dist-web/index.js",
},
default: {
types: "./dist-types/index.d.ts",
import: "./dist-node/index.js",
},
},
},
sideEffects: false,
},
null,
Expand Down

0 comments on commit 8d38d31

Please sign in to comment.