diff --git a/js/package.json b/js/package.json index 39c380e4..ea7316e4 100644 --- a/js/package.json +++ b/js/package.json @@ -14,9 +14,8 @@ "author": "zakstucke@gmail.com", "license": "MIT", "type": "module", - "main": "dist/bitbazaar/index.cjs", - "module": "dist/bitbazaar/index.js", - "types": "dist/bitbazaar/index.d.ts", + "module": "dist/index.js", + "types": "dist/index.d.ts", "sideEffects": false, "files": [ "dist" diff --git a/js/tsup.config.ts b/js/tsup.config.ts index f254b305..ec2fa278 100644 --- a/js/tsup.config.ts +++ b/js/tsup.config.ts @@ -2,20 +2,13 @@ import type { Options } from "tsup"; // https://dev.to/orabazu/how-to-bundle-a-tree-shakable-typescript-library-with-tsup-and-publish-with-npm-3c46 export const tsup: Options = { - splitting: true, clean: true, // clean up the dist folder dts: true, // generate dts files - format: ["cjs", "esm"], // generate cjs and esm files - minify: true, - bundle: false, + format: ["esm"], // Only support ESM, fixes lots of import problems + minify: false, // Again allow downstream consumers to minify + bundle: false, // Don't bundle, allow downstream consumers to bundle skipNodeModulesBundle: true, - entryPoints: ["bitbazaar/index.ts"], - watch: false, target: "es2020", outDir: "./dist", entry: ["bitbazaar/**/*.ts"], // look at all files in the project - esbuildOptions(options, context) { - // the directory structure will be the same as the source - options.outbase = "./"; - }, };