打开项目根目录的 package.json,然后找到scripts,如果你是希望在 npm run dev 的时候 内网可以方访问,那么你再 scripts下的dev 结尾增加一个参数
--host 192.168.0.123
就可以了 替换你的本机ip
完整的例子
"scripts": {
"dev": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.dev.config.js --host 192.168.0.123",
"dist:style": "gulp --gulpfile build/build-style.js",
"dist:dev": "webpack --config build/webpack.dist.dev.config.js",
"dist:prod": "webpack --config build/webpack.dist.prod.config.js",
"dist": "npm run dist:style && npm run dist:dev && npm run dist:prod",
"lint": "eslint --fix --ext .js,.vue src",
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
"test": "npm run lint && npm run unit",
"prepublish": "npm run dist"
}