@@ -29,6 +29,7 @@ module.exports = (api, options) => {
2929 // are running it in a mode with a production env, e.g. in E2E tests.
3030 const isProduction = process . env . NODE_ENV === 'production'
3131
32+ const path = require ( 'path' )
3233 const chalk = require ( 'chalk' )
3334 const webpack = require ( 'webpack' )
3435 const WebpackDevServer = require ( 'webpack-dev-server' )
@@ -63,7 +64,10 @@ module.exports = (api, options) => {
6364 if ( ! isProduction ) {
6465 const devClients = [
6566 // dev server client
66- require . resolve ( `webpack-dev-server/client` ) ,
67+ require . resolve ( `webpack-dev-server/client` ) +
68+ // fix webpack-dev-server socket url to /sockjs-node
69+ // in case it uses options.devBaseUrl
70+ '?/sockjs-node' ,
6771 // hmr client
6872 require . resolve ( projectDevServerOptions . hotOnly
6973 ? 'webpack/hot/only-dev-server'
@@ -102,14 +106,17 @@ module.exports = (api, options) => {
102106 const server = new WebpackDevServer ( compiler , Object . assign ( {
103107 clientLogLevel : 'none' ,
104108 historyApiFallback : {
105- disableDotRule : true
109+ disableDotRule : true ,
110+ rewrites : [
111+ { from : / ./ , to : path . posix . join ( options . devBaseUrl , 'index.html' ) }
112+ ]
106113 } ,
107114 contentBase : api . resolve ( 'public' ) ,
108115 watchContentBase : ! isProduction ,
109116 hot : ! isProduction ,
110117 quiet : true ,
111118 compress : isProduction ,
112- publicPath : '/' ,
119+ publicPath : options . devBaseUrl ,
113120 overlay : isProduction // TODO disable this
114121 ? false
115122 : { warnings : false , errors : true }
0 commit comments