How to configure VUE localhost and IP can be accessed

set to: host: "localhost" local IP cannot be accessed
set to: host:" 0.0.0.0" both local IP and localhost can be accessed, but every time you open it, you have to modify it manually. Is there any way to solve it?

Mar.10,2021

host: "0.0.0.0",
useLocalIp: true,
will do


1. Modify the configuration file of webpack
modify the host property in webpack.dev.js to '0.0.0.0'
2. Modify the command line parameters that enable webpack-dev-server in package.json, such as: dev start followed by
-- host 0.0.0.0


The dev of

script is followed by -- host 0.0.0.0

"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js --host 0.0.0.0"

I usually have these in host:

127.0.0.1         localhost
255.255.255.255     broadcasthost
::1              localhost
Menu