You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Vite in middleware mode for use with SSR. For reasons beside the point of this proposal, I proxy certain requests that I don't want Vite to handle to another server running on the same machine.
The problem is that the service being proxied to itself takes a ?raw query parameter to allow for serving the content a bit differently. This results in a conflict, because now when I send a request to the server with a ?raw suffix, Vite sees it first and throws me a [vite] Internal server error: ENOENT: no such file or directory, open '/whatever' error.
I suppose I could just rewrite my order of things in Express to have the routes I want handled differently to run before the Vite middleware so that there is no conflict, but that forces me to make my server a bit more arcane than I'd like. It would be much better if I could just tell Vite somehow what to actually call the ?raw suffix, making it ?vraw or something like that.
Suggested solution
Add a config options that lets us specify what to call the ?raw parameter, and any other ones that might result in a conflict when using Vite as a middleware.
Alternative
Reorder the Express server to make Vite lower priority. Not ideal in my opinion.
Thanks for the proposal @AaronBeaudoin. We are moving away from suffixes, so I don't think we are going to add options to rename them. We already started with import.meta.glob, see #7215
We are probably going to expose raw as:
import text from './path' as 'raw'
But we need to wait until the spec and tooling advances to be able to properly migrate. Closing this issue now as we aren't going to take action on it for the moment.
Clear and concise description of the problem
I'm using Vite in middleware mode for use with SSR. For reasons beside the point of this proposal, I proxy certain requests that I don't want Vite to handle to another server running on the same machine.
The problem is that the service being proxied to itself takes a
?raw
query parameter to allow for serving the content a bit differently. This results in a conflict, because now when I send a request to the server with a?raw
suffix, Vite sees it first and throws me a[vite] Internal server error: ENOENT: no such file or directory, open '/whatever'
error.I suppose I could just rewrite my order of things in Express to have the routes I want handled differently to run before the Vite middleware so that there is no conflict, but that forces me to make my server a bit more arcane than I'd like. It would be much better if I could just tell Vite somehow what to actually call the
?raw
suffix, making it?vraw
or something like that.Suggested solution
Add a config options that lets us specify what to call the
?raw
parameter, and any other ones that might result in a conflict when using Vite as a middleware.Alternative
Reorder the Express server to make Vite lower priority. Not ideal in my opinion.
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: