vitejs / vite

Next generation frontend tooling. It's fast!
http://vite.dev
MIT License
67.64k stars 6.09k forks source link

`fetch('/__open-in-editor')` in error overlay does not respect `base` #8627

Closed ascott18 closed 1 year ago

ascott18 commented 2 years ago

Describe the bug

  1. Have an app with a base configured.
  2. Introduce an error in your code that triggers the error overlay.
  3. Click a file link in the stack trace. Observe that no editor opens and the response to the request is The server is configured with a public base URL of /myBase/ - did you mean to visit ...

Note that requests to __vite_ping DO prepend base.

Reproduction

NOTE: It doesn't actually reproduce on stackblitz because they seem to have a web worker that intercepts __open_in_editor and does the necessary handling to make it work in that environment. You'll have to download it and run it locally.

https://stackblitz.com/edit/vitejs-vite-gknqnq?file=counter.js,vite.config.ts&terminal=dev

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz 
    Memory: 3.81 GB / 31.94 GB
  Binaries:
    Node: 16.15.1 - C:\Program Files\nodejs\node.EXE       
    Yarn: 1.15.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 102.0.5005.115
    Edge: Spartan (44.19041.1266.0), Chromium (102.0.1245.41)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    vite: 2.9.12 => 2.9.12

Used Package Manager

npm

Logs

No response

Validations

sapphi-red commented 2 years ago

It worked for me on windows. That said, it is a bug since the request should be prepended with base.