-
-
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
pluginContainer.resolveId(..., { ssr: true })
works differently from ssrLoadModule
resolution for "module"
entry/exports
#16631
Comments
|
It might be related to #12957 (comment) (haven't checked the repro deeply) |
Thanks for the reference. Yeah, cache issue part of the issue might be related to that. Another part of the issue is that it doesn't look like it's possible to exclude Currently I'm making a wip PR in #16647 to get On second thought, this didn't feel like a right problem to solve. Probably, what Vitest (or SSR in general) wants to do is to simply exclude vite/packages/vite/src/node/plugins/resolve.ts Lines 1101 to 1108 in c3f8691
|
pluginContainer.resolveId
works differently before and after ssrLoadModule
pluginContainer.resolveId(..., { ssr: true })
works differently before and after ssrLoadModule
pluginContainer.resolveId(..., { ssr: true })
works differently before and after ssrLoadModule
pluginContainer.resolveId(..., { ssr: true })
works differently from ssrLoadModule
resolution when "module"
entry
pluginContainer.resolveId(..., { ssr: true })
works differently from ssrLoadModule
resolution when "module"
entrypluginContainer.resolveId(..., { ssr: true })
works differently from ssrLoadModule
resolution for "module"
entry/exports
Describe the bug
I was investigating Vitest issue vitest-dev/vitest#5664 and I came across this confusing behavior while checking the reproduction.
The package in question has following exports and it looks like Vite SSR resolution changes which to pick
...cjs.mjs
or...esm.js
depending onssrLoadModule / resolveId
order.(This is what I made as a simpler repro based on
@emotion/react
https://publint.dev/@emotion/react@11.11.4)I'm not sure yet if this is directly relevant to the referenced Vitest issue, but I thought I'd share it here. I would appreciate if anyone knows whether this is a packaging issue, my incorrect usage, or Vite's resolution issue (or something else).
Reproduction
https://github.com/hi-ogawa/reproductions/blob/main/vitest-5664-mui-emotion-provider/repro-vite.mjs
Steps to reproduce
Running on stackblitz https://stackblitz.com/edit/github-htzuw3?file=repro-vite.mjs
Also comparing with NodeJS's resolution:
System Info
(stackblitz) System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 18.18.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.2.3 - /usr/local/bin/npm pnpm: 8.15.6 - /usr/local/bin/pnpm npmPackages: vite: 5.2.10 => 5.2.10
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: