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

Dev server will return index when file not exists #18107

Closed
7 tasks done
tocque opened this issue Sep 15, 2024 · 3 comments
Closed
7 tasks done

Dev server will return index when file not exists #18107

tocque opened this issue Sep 15, 2024 · 3 comments
Labels
invalid This doesn't seem right

Comments

@tocque
Copy link

tocque commented Sep 15, 2024

Describe the bug

request a not existed file will receive /index.html.

Reproduction

https://stackblitz.com/edit/vitejs-vite-vlvqcb?file=index.html&terminal=dev

Steps to reproduce

just visit https://vitejsvitevlvqcb-s5sf--5173--28a8ce1b.local-corp.webcontainer.io/aaa.js

System Info

System:
    OS: Windows 11 10.0.22635
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 2.30 GB / 15.84 GB
  Binaries:
    Node: 22.3.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.8.1 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.7.1 - ~\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.8)
    Internet Explorer: 11.0.22621.3566
  npmPackages:
    @vitejs/plugin-react: ^4.3.1 => 4.3.1 
    vite: ^5.4.5 => 5.4.5

Used Package Manager

pnpm

Logs

No response

Validations

Copy link

stackblitz bot commented Sep 15, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@hi-ogawa
Copy link
Collaborator

I would assume this is how SPA fallback works normally https://vitejs.dev/config/shared-options.html#apptype
For example, you can configure appType: "mpa" to avoid such fallback https://stackblitz.com/edit/vitejs-vite-gfcunr?file=vite.config.ts

@sapphi-red
Copy link
Member

Yep, this is an expected behavior.

@sapphi-red sapphi-red added invalid This doesn't seem right and removed pending triage labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants