-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Wrong File Served When Route Conflicts with File in Project Root #3502
Comments
…icts with the local file, fix issue vitejs#3502
@davezuko I figured out that vite will return the cached module I have submitted a pull request ,#3513 |
…icts with the local file, fix issue vitejs#3502
Still reproducible in Vite 2.8.6 |
I think it would be better to check the |
I think this "extension guessing" should be disabled or at least be made configurable to be disabled. I think it's bad practice to serve |
I think you should be able to achieve that already using resolve: {
extensions: []
} |
Tried setting
That |
mmm... ya, maybe some dependencies expect resolution to work. This should be better once everybody starts to use the |
This documentation does not appear to exist any more. Are there plans to replace it? |
Describe the bug
Vite Config:
Project Structure:
A request to
/route
will unexpectedly serve/route.ts
.Since the file extension is omitted, I would expect for the traditional
connect-history-api-fallback
logic to apply and for/index.html
to be served. If wanted to load the source file I would expect to have to make an explicit request for/route.ts
. It doesn't seem right for the file extension to be inferred.This is likely more of an issue for people like me who've configured
root
since that may mean source files sit at the top-level ofroot
instead of nested inside of asrc
directory. Still, for cases such as this, this issue becomes more problematic as more source files and routes are created, since there's more opportunity for an inadvertent conflict.Important: On the first load, you will actually see the correct fallback logic. It's only once vite has processed
route.ts
that the fallback behavior changes, and you'll start seeing a JavaScript file served instead of index.html.Thanks for your help!
Reproduction
https://github.com/davezuko/reproductions/tree/master/vite-3502
Steps to reproduce:
yarn dev
http://localhost:3000
, the app loads correctlyhttp://localhost:3000/test
, the app loads correctly (renders "/test")http://localhost:3000/route
, the app serves/route.ts
http://localhost:3000/main
, the app serves/main.ts
Alternate reproduction:
yarn dev
http://localhost:3000/route
, the app loads correctlyhttp://localhost:3000/route
, the app now serves/route.ts
System Info
Output of
npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
:Used package manager: yarn
Logs
Before submitting the issue, please make sure you do the following
The text was updated successfully, but these errors were encountered: