Skip to content

Commit 96dfd58

Browse files
authored
fix(serve): pass devServer sockPath properly to client (#4800)
closes #4400 closes #4430
1 parent a91649e commit 96dfd58

File tree

1 file changed

+4
-4
lines changed
  • packages/@vue/cli-service/lib/commands

1 file changed

+4
-4
lines changed

packages/@vue/cli-service/lib/commands/serve.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,10 @@ module.exports = (api, options) => {
127127

128128
// inject dev & hot-reload middleware entries
129129
if (!isProduction) {
130+
const sockPath = projectDevServerOptions.sockPath || '/sockjs-node'
130131
const sockjsUrl = publicUrl
131132
// explicitly configured via devServer.public
132-
? `?${publicUrl}/sockjs-node`
133+
? `?${publicUrl}&sockPath=${sockPath}`
133134
: isInContainer
134135
// can't infer public network url if inside a container...
135136
// use client-side inference (note this would break with non-root publicPath)
@@ -138,9 +139,8 @@ module.exports = (api, options) => {
138139
: `?` + url.format({
139140
protocol,
140141
port,
141-
hostname: urls.lanUrlForConfig || 'localhost',
142-
pathname: '/sockjs-node'
143-
})
142+
hostname: urls.lanUrlForConfig || 'localhost'
143+
}) + `&sockPath=${sockPath}`
144144
const devClients = [
145145
// dev server client
146146
require.resolve(`webpack-dev-server/client`) + sockjsUrl,

0 commit comments

Comments
 (0)