emilkowalski / sonner

An opinionated toast component for React.
https://sonner.emilkowal.ski
MIT License
8.37k stars 263 forks source link

fix: add "main" entry to package.json #457

Closed adamhenson closed 3 months ago

adamhenson commented 3 months ago

Issue:

Closes https://github.com/emilkowalski/sonner/issues/456

What has been done:

According to Node.js documentation only on older versions of Node.js should main be required.

For new packages targeting the currently supported versions of Node.js, the "exports" field is recommended. For packages supporting Node.js 10 and below, the "main" field is required. If both "exports" and "main" are defined, the "exports" field takes precedence over "main" in supported versions of Node.js.

~Regardless, Parcel doesn't seem to honor the sole existence of exports (without main). This change will support both by allowing exports to take precedence per the above.~

UPDATE: Seems like the issue could be due to conditional exports not supported in Parcel. I think this is good justification to add the main entry as a fallback for when conditional exports is not supported (like in the case of Parcel).

vercel[bot] commented 3 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sonner ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 23, 2024 3:45pm