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 devServer part:
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
stats: "errors-only",
hot: true,
open: true
If I delete the /undefined part of the URL it works properly even the hot module replacement so it's not a big problem; just want to know why is that happening.
Edit: Im on MacOS
Edit2: Console info when 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.
Ty
webpack-dev-server on port 8080 .
Webpack is a popular module bundler, a tool for bundling application source code in convenient chunks and for loading that code from a server into a browser. It's an excellent alternative to the SystemJS approach used elsewhere in the documentation.
You can check which files are being served by the dev server by going to /webpack-dev-server route. For example, localhost:9000/webpack-dev-server.
This seems to be caused by a bug: 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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With