Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 477
Folaht Avatar asked Oct 16 '18 06:10

Folaht


People also ask

How do I stop vue server command line?

Try using Ctrl-C instead. It allows the application to gracefully shut down.

What server does vue cli use?

The vue-cli-service serve command starts a dev server (based on webpack-dev-server) that comes with Hot-Module-Replacement (HMR) working out of the box.

What is vue-cli-service global?

@vue/cli-service-global is a package that allows you to run vue serve and vue build without any local dependencies. @vue/cli-service is a package that actually doing those vue serve and vue build , both @vue/cli-service-global and @vue/cli depend on it.


1 Answers

// 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
like image 91
Bob Fanger Avatar answered Sep 18 '22 15:09

Bob Fanger