devtools icon indicating copy to clipboard operation
devtools copied to clipboard

The injection script is attempting to use fileURLToPath from the client

Open dr-iroh opened this issue 6 months ago • 1 comments

Describe the bug

I'm using @vitejs/[email protected] and manually injecting @vitejs/devtools/client/inject on the client side, and I'm getting this error. My app is SSR-based.

DockStandalone-Y7CEWFPN-BDo6WdN9.js?v=09397d90:301 Uncaught (in promise) TypeError: (0 , import_browser_external_node_url.fileURLToPath) is not a function at DockStandalone-Y7CEWFPN-BDo6WdN9.js?v=09397d90:301:66

Image

vite.config.ts

export default defineConfig({
  plugins: [
    vue(),
    nitro(),
    DevTools()
  ]
});

main.ts

if (import.meta.hot) {
  import('@vitejs/devtools/client/inject');
}

Reproduction

Shown above

System Info

System:
    OS: Linux 6.11 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
    CPU: (4) x64 Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz
    Memory: 3.03 GB / 7.68 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 24.15.0 - /home/iroh/.nvm/versions/node/v24.15.0/bin/node
    npm: 11.12.1 - /home/iroh/.nvm/versions/node/v24.15.0/bin/npm
    bun: 1.3.14 - /home/iroh/.bun/bin/bun
  Browsers:
    Chrome: 148.0.7778.167
    Firefox: 150.0.3
    Firefox Developer Edition: 150.0.3

Used Package Manager

bun

Validations

  • [x] Follow our Code of Conduct
  • [x] Read the Contributing Guide.
  • [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [x] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [x] The provided reproduction is a minimal reproducible of the bug.

dr-iroh avatar May 14 '26 22:05 dr-iroh

This should be fixed by #347

antfu avatar May 15 '26 02:05 antfu