fix: respect top-level server.preTransformRequests#19272
fix: respect top-level server.preTransformRequests#19272patak-cat merged 4 commits intovitejs:mainfrom
server.preTransformRequests#19272Conversation
5c35f99 to
97d7f6e
Compare
server.preTransformRequestsserver.preTransformRequests
server.preTransformRequestspreTransformRequests
preTransformRequestsserver.preTransformRequests
commit: |
Checking the reason why this options was introduced (#6309), maybe it makes sense to sync the value with
I didn't find any links, but I think this was a intentional change. |
patak-cat
left a comment
There was a problem hiding this comment.
Let's merge this fix for now. I also think the change to only pre transform for the client was intentional but I can't find now a reference for that. We should change that default in another PR if we think that is needed. For environments running in different processes, maybe we have the same peformance profile as with the browser requesting modules. I don't recall us doing profiling for different cases with and without preTransformRequests for SSR. But Vitest disables it for performance reasons IIRC.
|
I noticed I had a typo in the previous message (I wrote inside instead of instead 🤦). |
Description
It looks like there were two changes related to
preTransformRequestson Vite 6, namely:server.preTransformRequestshas no effect onenvironment.dev.preTransformRequests.server.preTransformRequests: trueby default both on client and ssr on Vite 5, now only client environmentdev.preTransformRequests: trueand ssr does not pre transform by default.I made a reproduction in https://github.com/hi-ogawa/reproductions/tree/main/vitest-7345-preTransformRequests-false.
I assume the first one is a bug since currently
server.preTransformRequestsis no-op and we should either deprecate/remove or use it as a default. This is what this PR addresses and I confirmed this fixed Vitest's issue https://stackblitz.com/edit/bolt-vue-7wha3d5d?file=package.json. There are also some usages in the wild https://github.com/search?q=preTransformRequests&type=code.For the 2nd one, I wasn't aware of this change and I'm not sure if it's intended. I'll leave this part out of the PR for now.