From 9d435e346633f471ca49057df6f923e47d22aece Mon Sep 17 00:00:00 2001 From: Albert Brand Date: Tue, 5 Nov 2019 21:31:07 +0100 Subject: [PATCH] fix(serve): pass devServer sockPath properly to client --- packages/@vue/cli-service/lib/commands/serve.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/@vue/cli-service/lib/commands/serve.js b/packages/@vue/cli-service/lib/commands/serve.js index e5b42daadd..08cffccdb0 100644 --- a/packages/@vue/cli-service/lib/commands/serve.js +++ b/packages/@vue/cli-service/lib/commands/serve.js @@ -126,9 +126,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) @@ -137,9 +138,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,