Webpack-dev-server opens localhost: 8080 / undefined

When I run $ npm run dev ( "dev": "webpack-dev-server" ), it opens localhost: 8080 / undefined instead of localhost: 8080 or at least localhost: 8080 / index.html

webpack-config.js part of devServer:

devServer: {

  contentBase: path.join(__dirname, 'dist'), compress: true, stats: "errors-only", hot: true, open: true 

If I remove the part of the / undefined URL, it works fine even with a hot module replacement, so this is not a big problem; just want to know why this is happening.

Edit: Im on macOS

Edit2: console information at npm run dev :

Project is running at http://localhost:8080/ webpack output is served from / Content not from webpack is served from /Users/cozarkd/folders/dist webpack: wait until bundle finished: /undefined webpack: Compiled successfully.

T

+5
source share
1 answer

This seems to be caused by an error: https://github.com/webpack/webpack-dev-server/issues/960

A quick workaround is offered ( here ):

 devServer: { contentBase: path.join(__dirname, 'dist'), compress: true, stats: "errors-only", hot: true, open: true, openPage: '' // <-- this } 
+13
source

Source: https://habr.com/ru/post/1269518/


All Articles