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
Contrary to the docs and expected behavior. Vite picks "module": "./node.mjs" and I get Node ESM printed. According to the docs, and Node.JS behavior, exports should be preferred and used when specified (P.S. Vite AFAIK doesn't use the browser main field).
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
I have the same issue, except that even module path from package.json is ignored, and main is always used instead. This happens for executing a build (vite-build command) and when running a dev server, it picks the right one.
Ooofff the way Vite resolves entry points from package.json just seems all over the place and doesn't really match how Node or other bundlers work... Wish this could get some traction so I won't end up with so many weird cases of Vite trying to bundle Node code instead of browser. Heck, even the official @vue/devtools package is effected...
Describe the bug
I have a library that defines:
Contrary to the docs and expected behavior. Vite picks
"module": "./node.mjs"
and I getNode ESM
printed. According to the docs, and Node.JS behavior,exports
should be preferred and used when specified (P.S. Vite AFAIK doesn't use thebrowser
main field).Reproduction
https://stackblitz.com/edit/vitejs-vite-sh5wuy?file=lib/package.json
System Info
Used Package Manager
pnpm
Logs
Click to expand!
It should be
Browser ESM
.Validations
The text was updated successfully, but these errors were encountered: