Skip to content
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

Allow renaming ?raw suffix to something else #7213

Closed
4 tasks done
AaronBeaudoin opened this issue Mar 7, 2022 · 1 comment
Closed
4 tasks done

Allow renaming ?raw suffix to something else #7213

AaronBeaudoin opened this issue Mar 7, 2022 · 1 comment

Comments

@AaronBeaudoin
Copy link

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

@patak-dev
Copy link
Member

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.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants