-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
fix: respect top-level server.preTransformRequests
#19272
fix: respect top-level server.preTransformRequests
#19272
Conversation
5c35f99
to
97d7f6e
Compare
server.preTransformRequests
server.preTransformRequests
server.preTransformRequests
preTransformRequests
preTransformRequests
server.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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
preTransformRequests
on Vite 6, namely:server.preTransformRequests
has no effect onenvironment.dev.preTransformRequests
.server.preTransformRequests: true
by default both on client and ssr on Vite 5, now only client environmentdev.preTransformRequests: true
and 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.preTransformRequests
is 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.