You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many tools and frameworks now prefer ESM for tree-shaking and performance.
Some environments even throw warnings or errors if a package only exports CJS.
Supporting both CJS and ESM is the current best practice, as seen in many popular libraries.
This makes the package compatible with both ESM and CommonJS consumers and aligns with modern package publishing practices. It helps when using this library in native ESM projects (e.g., with Vite or Next.js App Router using ESM).
Compatibility
✅ This change is non-breaking
✅ Existing CommonJS users will continue to work exactly as before
✅ ESM users gain full support with no hacks
I'm happy to open a pull request with these changes just let me know if you're open to it!
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
What
I suggest updating the
tsup.config.ts
to include ESM format output:And updating package.json to include the module field and a more structured exports map that distinguishes between ESM and CJS, like this:
Why this matters
This makes the package compatible with both ESM and CommonJS consumers and aligns with modern package publishing practices. It helps when using this library in native ESM projects (e.g., with Vite or Next.js App Router using ESM).
Compatibility
✅ This change is non-breaking
✅ Existing CommonJS users will continue to work exactly as before
✅ ESM users gain full support with no hacks
I'm happy to open a pull request with these changes just let me know if you're open to it!
The text was updated successfully, but these errors were encountered: