@@ -90,15 +90,14 @@ export class DevServerBuilder implements Builder<DevServerBuilderOptions> {
90
90
}
91
91
92
92
// Resolve public host and client address.
93
- let clientAddress = `${ options . ssl ? 'https' : 'http' } ://0.0.0.0:0` ;
93
+ let clientAddress = url . parse ( `${ options . ssl ? 'https' : 'http' } ://0.0.0.0:0` ) ;
94
94
if ( options . publicHost ) {
95
95
let publicHost = options . publicHost ;
96
96
if ( ! / ^ \w + : \/ \/ / . test ( publicHost ) ) {
97
97
publicHost = `${ options . ssl ? 'https' : 'http' } ://${ publicHost } ` ;
98
98
}
99
- const clientUrl = url . parse ( publicHost ) ;
100
- options . publicHost = clientUrl . host ;
101
- clientAddress = url . format ( clientUrl ) ;
99
+ clientAddress = url . parse ( publicHost ) ;
100
+ options . publicHost = clientAddress . host ;
102
101
}
103
102
104
103
// Resolve serve address.
@@ -250,7 +249,7 @@ export class DevServerBuilder implements Builder<DevServerBuilderOptions> {
250
249
options : DevServerBuilderOptions ,
251
250
browserOptions : NormalizedBrowserBuilderSchema ,
252
251
webpackConfig : any , // tslint:disable-line:no-any
253
- clientAddress : string ,
252
+ clientAddress : url . UrlWithStringQuery ,
254
253
) {
255
254
// This allows for live reload of page when changes are made to repo.
256
255
// https://webpack.js.org/configuration/dev-server/#devserver-inline
@@ -260,7 +259,14 @@ export class DevServerBuilder implements Builder<DevServerBuilderOptions> {
260
259
} catch {
261
260
throw new Error ( 'The "webpack-dev-server" package could not be found.' ) ;
262
261
}
263
- const entryPoints = [ `${ webpackDevServerPath } ?${ clientAddress } ` ] ;
262
+
263
+ // If a custom path is provided the webpack dev server client drops the sockjs-node segment.
264
+ // This adds it back so that behavior is consistent when using a custom URL path
265
+ if ( clientAddress . pathname ) {
266
+ clientAddress . pathname = path . posix . join ( clientAddress . pathname , 'sockjs-node' ) ;
267
+ }
268
+
269
+ const entryPoints = [ `${ webpackDevServerPath } ?${ url . format ( clientAddress ) } ` ] ;
264
270
if ( options . hmr ) {
265
271
const webpackHmrLink = 'https://webpack.js.org/guides/hot-module-replacement' ;
266
272
0 commit comments