fix(resolve): fix resolve cache to consider conditions and more#18302
Conversation
|
|
|
I created a bench script with Negative perf impact on cpuprofile viz |
patak-cat
left a comment
There was a problem hiding this comment.
I think we should move forward with this fix for now. In the future, we could explore moving the resolve cache to the environment instance and pass it to the resolve plugin options.
|
Maybe a simpler approach to split the cache for environment is to split I was testing css |
sapphi-red
left a comment
There was a problem hiding this comment.
I tested removing the whole resolvedCache but it seems that degrades perf by ~10%. It seems we need to keep this.
I also tested this branch with #16631. The issue is now fixed and server.ssrLoadModule resolves to dist/emotion-react.cjs.mjs even after server.pluginContainer.resolveId is called.
|
I was thinking we can instantiate a dedicated vite/packages/vite/src/node/baseEnvironment.ts Lines 67 to 80 in 25868f2 |
|
I made |
patak-cat
left a comment
There was a problem hiding this comment.
As proposed by @hi-ogawa in the linked PR, we could move forward with this one to get the fix in, and then rework in a future PR to optimize it. @sapphi-red I'll let you merge it if you are ok with this


Description
resolve.conditionsnot working reliably on custom environment #18222pluginContainer.resolveId(..., { ssr: true })works differently fromssrLoadModuleresolution for"module"entry/exports #16631 tooI simply expanded the cache key of "resolved cache", but I'm not sure if just concatenating everything is the best way in terms of performance.
todo