Skip to content

Commit

Permalink
fix: only publish single bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy1339 committed Feb 27, 2024
1 parent d98695e commit 093757d
Showing 1 changed file with 8 additions and 22 deletions.
30 changes: 8 additions & 22 deletions scripts/build.mjs
Expand Up @@ -13,6 +13,8 @@ const sharedOptions = {
allowOverwrite: true,
packages: "external",
format: "esm",
target: "es2022",
platform: "neutral"
};

async function main() {
Expand All @@ -23,7 +25,6 @@ async function main() {
entryPoints: await glob(["./src/*.ts", "./src/**/*.ts"]),
outdir: "pkg/dist-src",
bundle: false,
platform: "neutral",
...sharedOptions,
sourcemap: false,
});
Expand All @@ -37,27 +38,12 @@ 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",
...sharedOptions,
}),
// Build an ESM browser bundle
esbuild.build({
entryPoints,
outdir: "pkg/dist-web",
bundle: true,
platform: "browser",
...sharedOptions,
}),
]);
await esbuild.build({
entryPoints: ["./pkg/dist-src/index.js"],
outdir: "pkg/dist-bundle",
bundle: true,
...sharedOptions,
});

// Copy the README, LICENSE to the pkg folder
await copyFile("LICENSE", "pkg/LICENSE");
Expand Down

0 comments on commit 093757d

Please sign in to comment.