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
ESM module for both Node.js and the Browser? #1154
Comments
Reverted in 6ce6d5c |
It still works for |
Can I override/modify this behavior somehow for my own project (or maybe even on a per dependency level)? (esbuild provides a similar option via |
@schickling latest has again adjusted to prioritize |
In my case I want to explicitly pick the Could you provide an example of how to do this via |
Please read the docs https://vitejs.dev/config/#alias |
I see. So if I'm understanding correctly there isn't a way via |
@schickling globally adjust main field resolving is actually less ideal, because you can accidentally break other packages that have different package.json export formats. Vite used to prioritize |
Yup, that's exactly what I was planning to do. I was just wondering whether there's a way to do the remapping indirectly on the "main field" level as opposed to directly on the file level via |
Describe the bug
The
httpie
package specifies "browser" paths on itspackage.json
multiple times, but frontend build tools don't seem to pick up the correct file (always selectingnode/index.mjs
)ERROR
Reproduction
I've created a repository describing this problem https://github.com/endel/esm-browser-node
In fact, this problem is present on every ESM JavaScript bundler, I've found it very difficult to search about this on the web and I appreciate if you could point me in the right direction in case there is some discussion already going on about this! 🙏
The text was updated successfully, but these errors were encountered: