From 093757ddecb5004362e346a1c36f5139d52eda20 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Mon, 26 Feb 2024 20:41:05 -0500 Subject: [PATCH] fix: only publish single bundle --- scripts/build.mjs | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/scripts/build.mjs b/scripts/build.mjs index 4ff39ce..bde408b 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -13,6 +13,8 @@ const sharedOptions = { allowOverwrite: true, packages: "external", format: "esm", + target: "es2022", + platform: "neutral" }; async function main() { @@ -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, }); @@ -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");