-
-
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
resolve.conditions
not working reliably on custom environment
#18222
Comments
resolve.conditions
not working reliably on custom environmentresolve.conditions
not working reliably on custom environment with webCompatible: true
resolve.conditions
not working reliably on custom environment with webCompatible: true
resolve.conditions
not working reliably on custom environment
It looks like the issue is vite/packages/vite/src/node/packages.ts Lines 28 to 29 in 95020ab
Similar issue about the fact that cache key is too coarse is discussed in #12957 (comment) |
This was broken before too then, in case |
Probably so but maybe only when
I haven't digested the other issue #12957 (comment) but it looks like per-environment is not enough since there might be a case where single environment should resolve differently based on EDIT: I checked Vite 5 and indeed the issue is the same but only when |
Describe the bug
I'm testing a custom environment like:
and a package like:
When importing such package both from default client environment and custom environment, custom environment side picks up
./index.browser.js
in some cases.Reproduction
https://github.com/hi-ogawa/reproductions/tree/main/vite-environment-resolve-condition
Steps to reproduce
client: index.browser.js
correctly/worker
linkworker: index.browser.js
but it's expected to showworker: index.worker.js
/custom1
linkcustom1: index.browser.js
but it's expected to showcustom1: index.custom1.js
/worker
link againworker: index.worker.js
/custom1
linkcustom1: index.worker.js
but it's expected to showcustom1: index.custom1.js
In this reproduction, I added three extra custom environments with and without
webCompatible: true
.It looks like the one withIt looks like resolution is cached bywebCompatible
has some mixed up resolutions depending on the order how they are resolved.webCompatible
, so for eachtrue/false
case, resolution depends on the order how they are resolved.I also tested with the latest https://pkg.pr.new/vite@95020ab but the behavior seems to be same.
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.20.3 - /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: 6.0.0-beta.1 => 6.0.0-beta.1
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: