-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
When importing some modules with multiple entry points in package.json, the server version is selected instead of the browser version #2329
Comments
vite/packages/vite/src/node/plugins/resolve.ts Lines 487 to 495 in 4396057
This seems to be a purposeful decision, though you'll need to wait for one of the core team members to comment on what to do here. Vite is an ES-focused tool, might be time to upgrade rather than still relying on UMD |
That's interesting indeed, thanks for that! I'm thinking it'd be nice to be able to override that behaviour for specific modules (like this one, where I don't control how it gets packaged and can't force them to update, but it works fine as a UMD module with vite already). If the alias is the best way to do that configuration, I'm fine with that, more just wanted to check that it's definitely the best way to be doing this. |
Vite tries its best to guess package authors intentions but due to how both Also, ask the package to add conditional |
In case anyone finds this issue in regards to Okta specifically, the conversation with them about how to better structure their |
Describe the bug
When I do this:
I get this:
serverStorage
should only be used when running in Node.Testing a bit further, it definitely looks like
vite
is resolving to the server module, not the browser module for this dependency. In their package.json file:I can work around it like this:
vite.config.ts
Can I make
vite
use thebrowser
entry point so I get the browser version of the library in a less hacky, more supported way?Reproduction
https://github.com/thekevinbrown/vite-okta-reproduction
System Info
vite
version: "^2.0.1"The text was updated successfully, but these errors were encountered: