15

当我运行一个 vue-cli 项目时,我看到了这个:

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.

我不希望我的应用程序在本地网络上运行,只在本地主机上运行。如何关闭本地网络部分?

4

1 回答 1

25
// vue.config.js
{
  devServer: {
    host: "localhost"
  }
}

设置host"localhost"将禁用 webpack-dev-server 中的网络访问。

App running at:
 - Local:   http://localhost:8080/
 - Network: unavailable
于 2018-10-16T07:18:21.840 回答