From 479d0b4c4916720c7822a24eb108f6322252b5a7 Mon Sep 17 00:00:00 2001 From: wolfy1339 <4595477+wolfy1339@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:11:39 -0500 Subject: [PATCH] fix(build): remove NodeJS/Browser specific builds (#404) The 2 builds are the same in this case. It fixes usage with the `moduleResolution` option set to `bundler` --- scripts/build.mjs | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/scripts/build.mjs b/scripts/build.mjs index dbd8922..ec1e490 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -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"); @@ -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