Skip to content

Commit

Permalink
fix(serve): pass devServer sockPath properly to client (#4800)
Browse files Browse the repository at this point in the history
closes #4400
closes #4430
  • Loading branch information
AlbertBrand committed May 14, 2020
1 parent a91649e commit 96dfd58
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/@vue/cli-service/lib/commands/serve.js
Expand Up @@ -127,9 +127,10 @@ module.exports = (api, options) => {

// inject dev & hot-reload middleware entries
if (!isProduction) {
const sockPath = projectDevServerOptions.sockPath || '/sockjs-node'
const sockjsUrl = publicUrl
// explicitly configured via devServer.public
? `?${publicUrl}/sockjs-node`
? `?${publicUrl}&sockPath=${sockPath}`
: isInContainer
// can't infer public network url if inside a container...
// use client-side inference (note this would break with non-root publicPath)
Expand All @@ -138,9 +139,8 @@ module.exports = (api, options) => {
: `?` + url.format({
protocol,
port,
hostname: urls.lanUrlForConfig || 'localhost',
pathname: '/sockjs-node'
})
hostname: urls.lanUrlForConfig || 'localhost'
}) + `&sockPath=${sockPath}`
const devClients = [
// dev server client
require.resolve(`webpack-dev-server/client`) + sockjsUrl,
Expand Down

0 comments on commit 96dfd58

Please sign in to comment.