diff --git a/.changeset/few-ears-nail.md b/.changeset/few-ears-nail.md new file mode 100644 index 0000000..997afc3 --- /dev/null +++ b/.changeset/few-ears-nail.md @@ -0,0 +1,10 @@ +--- +'pumpit': major +--- + +refactor package export fields to include separate require statements. + +closes Support --moduleResolution node16 in typescript #38 + +more info on the problem: +https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseESM.md diff --git a/package.json b/package.json index 2ebf122..a023577 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,14 @@ "types": "./dist/index.d.ts", "exports": { ".": { - "types": "./dist/index.d.ts", - "import": "./dist/pumpit.js", - "require": "./dist/pumpit.umd.cjs" + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/pumpit.js" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/pumpit.umd.cjs" + } } }, "files": [ @@ -33,7 +38,7 @@ "lint:ci": "eslint \"src/**/\"", "test": "vitest run --coverage", "test:watch": "vitest", - "build": "tsc && vite build", + "build": "tsc && vite build && shx cp ./dist/index.d.ts ./dist/index.d.cts", "gen:docs": "rm -rf ./docs/api && typedoc --options typedoc.cjs --plugin typedoc-plugin-markdown", "prepublishOnly": "pnpm build", "prepare": "husky install", diff --git a/vite.config.ts b/vite.config.ts index 9085a09..b83d1ab 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -15,5 +15,5 @@ export default defineConfig({ minifyWhitespace: true, legalComments: 'none' }, - plugins: [dts()] + plugins: [dts({ rollupTypes: true })] })