Skip to content

Commit

Permalink
fix(build): remove NodeJS/Browser specific builds (#404)
Browse files Browse the repository at this point in the history
The 2 builds are the same in this case. It fixes usage with the `moduleResolution` option set to `bundler`
  • Loading branch information
wolfy1339 committed Feb 23, 2024
1 parent db5708e commit 479d0b4
Showing 1 changed file with 3 additions and 33 deletions.
36 changes: 3 additions & 33 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,6 @@ async function main() {
await rm(typeFile);
}

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

await Promise.all([
// Build the a CJS Node.js bundle
esbuild.build({
entryPoints,
outdir: "pkg/dist-node",
bundle: true,
platform: "node",
target: "node18",
format: "esm",
...sharedOptions,
}),
// Build an ESM browser bundle
esbuild.build({
entryPoints,
outdir: "pkg/dist-web",
bundle: true,
platform: "browser",
format: "esm",
...sharedOptions,
}),
]);

// Copy the README, LICENSE to the pkg folder
await copyFile("LICENSE", "pkg/LICENSE");
await copyFile("README.md", "pkg/README.md");
Expand All @@ -76,18 +52,12 @@ async function main() {
files: ["dist-*/**", "bin/**"],
exports: {
".": {
node: {
types: "./dist-types/index.d.ts",
import: "./dist-node/index.js",
},
browser: {
types: "./dist-types/index.d.ts",
import: "./dist-web/index.js",
}
types: "./dist-types/index.d.ts",
import: "./dist-src/index.js",
}
},
sideEffects: false,
unpkg: "dist-web/index.js",
unpkg: "dist-src/index.js",
},
null,
2
Expand Down

0 comments on commit 479d0b4

Please sign in to comment.