-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Conditional Export Resolves Incorrectly For Browser After Previously Loading For SSR #4968
Comments
I'm attempting to debug this right now, and I think I found a really solid lead.
{
"bruh/dom": {
"file": "/home/daniel/Development/buggy/node_modules/.vite/bruh_dom.js",
"src": "/home/daniel/Development/buggy/node_modules/bruh/src/dom/node/index.mjs",
"needsInterop": false
}
} It seems that this object maps from the import to a previously vite-transformed version - but there is no specifier of the export condition that leads the import Where this goes wrong is when an assumption is made that Here is the story, roughly as I see it from my debugging session:
It looks like the source of the problem was the assumption that a vite dev server won't have to worry about different import conditions. I fixed this bug by simply making Quick note: my proposal for a generalized |
@bluwy @ygj6 Yes, it looks like #5017 solved this! One thing that it potentially regressed, however -> https://github.com/vitejs/vite/pull/5017/files#r723797042 |
closing as #4968 (comment) should be resolved with #5248 in 2.6.11 improved version #5827 in 2.7.0-beta.9 |
Describe the bug
I am encountering this bug where after resolving an conditional export for node in SSR, that same conditional export will incorrectly load the node version in a browser script. For some reason, this only happens in this one case during dev mode.
Reproduction
I tried to make a simpler reproduction but I only find the bug appearing in this case, and it is simple enough to replicate.
FYI for full transparency, this will run this npm init script which creates a vite project which uses this vite plugin and the offending conditional exports can be found in this
package.json
.System Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: