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
My package is 100% ESM, and I'm using Vite for development and production builds.
To Reproduce
Create any blank Vite project and add+import Eta
Expected behavior browser.module.mjs should be used instead of eta.module.mjs
Screenshots
vite v5.2.8 building for production...
[plugin:vite:resolve] [plugin vite:resolve] Module "node:path" has been externalized for browser compatibility, imported by "/Users/nick/Code/burnside-web/node_modules/eta/dist/eta.module.mjs". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Package & Environment Details
Environment: Vite
Version: 5.2.8
Additional context
This was tackled in #146, and the suggested workaround was detailed in #242, namely to use:
import{Eta}from"eta/dist/browser.module.mjs";
However, this does not work in an ESM project that supports the exports keyword in package.json - since this import isn't explicitly defined there!
This modified exports key in package.json fixes the issue for me:
Describe the bug
My package is 100% ESM, and I'm using Vite for development and production builds.
To Reproduce
Create any blank Vite project and add+import Eta
Expected behavior
browser.module.mjs
should be used instead ofeta.module.mjs
Screenshots
Package & Environment Details
Additional context
This was tackled in #146, and the suggested workaround was detailed in #242, namely to use:
However, this does not work in an ESM project that supports the
exports
keyword inpackage.json
- since this import isn't explicitly defined there!This modified
exports
key inpackage.json
fixes the issue for me:With this, I can write:
And everything works as expected, including types.
The text was updated successfully, but these errors were encountered: