Skip to content

Commit 2dd1556

Browse files
authored
feat(persist): add 'exports' field for proper ESM/CJS resolution (#4611)
* feat(persist): add 'exports' field for proper ESM/CJS resolution What: add "exports" field to package.json, mapping ESM to ./dist/module.esm.js and CJS to ./dist/module.cjs.js Why: tools like Vite default to main when exports is absent, causing CJS to be used in dev server and breaking default export detection. How: update package.json, built & tested locally with Vite and Node (import/require). Backward compatibility: keeps existing main & module fields. * Format package.json
1 parent 960ce5c commit 2dd1556

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/persist/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,9 @@
1313
"main": "dist/module.cjs.js",
1414
"module": "dist/module.esm.js",
1515
"unpkg": "dist/cdn.min.js",
16+
"exports": {
17+
"import": "./dist/module.esm.js",
18+
"require": "./dist/module.cjs.js"
19+
},
1620
"dependencies": {}
1721
}

0 commit comments

Comments
 (0)