How do I disable running an app on the local network when using vue-cli?

Folatt picture Folatt · Oct 16, 2018 · Viewed 7.9k times · Source

When I run a vue-cli project I see this:

DONE  Compiled successfully in 5778ms

  App running at:
  - Local:   http://localhost:8080/ 
  - Network: http://192.168.178.9:8080/

  Note that the development build is not optimized.
  To create a production build, run npm run build.

I don’t want my app to be running on the local network, only local host. How do I turn the local network part off?

Answer

Bob Fanger picture Bob Fanger · Oct 16, 2018
// vue.config.js
{
  devServer: {
    host: "localhost"
  }
}

Setting host to "localhost" will disable network access in the webpack-dev-server.

App running at:
 - Local:   http://localhost:8080/
 - Network: unavailable