Skip to content

Commit 7b92f7b

Browse files
fix: add exports field to package.json for ESM/CJS resolution
Resolves SSR ERR_MODULE_NOT_FOUND by exposing explicit import/require conditions. Also corrects "module" and "types" paths to match the actual tsdown output (.mjs / .d.cts). Closes #584 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 415e4b7 commit 7b92f7b

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,20 @@
1818
"dist/"
1919
],
2020
"main": "./dist/index.cjs",
21-
"module": "./dist/index.js",
22-
"types": "./dist/index.d.ts",
21+
"module": "./dist/index.mjs",
22+
"types": "./dist/index.d.cts",
23+
"exports": {
24+
".": {
25+
"import": {
26+
"types": "./dist/index.d.mts",
27+
"default": "./dist/index.mjs"
28+
},
29+
"require": {
30+
"types": "./dist/index.d.cts",
31+
"default": "./dist/index.cjs"
32+
}
33+
}
34+
},
2335
"scripts": {
2436
"dev": "tsdown index.ts --format esm,cjs --dts --watch",
2537
"build": "tsdown index.ts --format esm,cjs --dts --minify",

0 commit comments

Comments
 (0)