Skip to content

Commit

Permalink
fix: specify the client port explicitly
Browse files Browse the repository at this point in the history
Necessary to avoid a warning when using a fallback after the connection
fails, since `rack-proxy` does not support proxying websockets.

vitejs/vite#8650
  • Loading branch information
ElMassimo committed Jul 14, 2022
1 parent 73d7a22 commit 3dd06db
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion vite-plugin-ruby/src/index.ts
Expand Up @@ -35,7 +35,12 @@ function config (userConfig: UserConfig, env: ConfigEnv): UserConfig {
const { assetsDir, base, outDir, host, https, port, root, entrypoints, ssrBuild } = config

const fs = { allow: [projectRoot], strict: true }
const server = { host, https, port, strictPort: true, fs }

// Connect directly to the Vite dev server, rack-proxy does not proxy websocket connections.
const hmr = userConfig.server?.hmr ?? {}
if (typeof hmr === 'object') hmr.clientPort = port

const server = { host, https, port, strictPort: true, fs, hmr }

const isLocal = config.mode === 'development' || config.mode === 'test'

Expand Down

0 comments on commit 3dd06db

Please sign in to comment.