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

File based routing breaks vite plugins that can't process query params in filename #389

Open
toakleaf opened this issue Oct 3, 2024 · 1 comment

Comments

@toakleaf
Copy link
Contributor

toakleaf commented Oct 3, 2024

For file based routing Vinxi adds query params to filenames for pick options like page.tsx?pick=default. These query params cause some vite plugins to choke (as they are expecting filename strings to end with extension).

Stackblitz example.

I'm currently able to get around this by forking these plugins and passing the filenames through vite's cleanUrl utility before rolling along.

I'm not sure what the best solution to this is, but don't think that current status quo of breaking vite plugins that have an expectation of file extensions coming at end of filename strings is a great state to be in.

One final note: for one of my projects this issue only arose for vinxi build runs, and the query params were somehow stripped during vinxi dev. However, when I was writing the stackblitz example query params weren't being stripped in either case.

@nksaraf
Copy link
Owner

nksaraf commented Oct 9, 2024

Yeah this has been a thing I have thought about, in some ways I'm stuck .. I need to add these differentiators in the moduleIds that make them different, vite uses this pattern too in places to process files specially so I am usually surprised people are expecting to get by without stripping the query Params from the module id .. vite cleans it up before resolving it and so by not add a prefix and a query Param instead I can use the default vite resolver which would be tricky to replicate .. step 1 is to detect this case maybe and then show a warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants