Skip to content

feat(persist): add 'exports' field for proper ESM/CJS resolution #4611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tani
Copy link

@tani tani commented May 3, 2025

Hi, there. Thank you for the awesome project! I'd like to propose the following change:

  • 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.

tani added 2 commits May 3, 2025 11:18
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant