crxjs / chrome-extension-tools

Bundling Chrome Extensions can be pretty complex. It doesn't have to be.
https://crxjs.dev/vite-plugin
2.98k stars 192 forks source link

WebSocket connection to 'ws://localhost/' failed: #648

Open tjx666 opened 1 year ago

tjx666 commented 1 year ago

Build tool

Vite

Where do you see the problem?

Describe the bug

image

I can still reproduce this in latest @crxjs/vite-plugin version: 2.0.0-beta.12

Reproduction

  1. git clone git@github.com:thetarnav/solid-devtools.git
  2. pnpm install
  3. pnpm dev:ext
  4. load extension at packages/extension/dist

Logs

No response

System Info

System:
    OS: macOS 13.2.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 142.24 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.14.1 - ~/Library/Caches/fnm_multishells/36587_1676917501753/bin/node
    npm: 9.5.0 - ~/Library/Caches/fnm_multishells/36587_1676917501753/bin/npm
  Browsers:
    Chrome: 110.0.5481.100
    Chrome Canary: 112.0.5607.0
    Firefox: 109.0.1
    Firefox Developer Edition: 111.0
    Safari: 16.3
  npmPackages:
    vite: ^4.1.1 => 4.1.1
    @crxjs/vite-plugin: ^1.0.14

Severity

annoyance

cutsin commented 1 year ago

Specify a port number can resolve this:

// vite.config.ts
{
  server: { port: 3000, hmr: { port: 3000 } }
}