添加linux server模型下调试zhic

This commit is contained in:
aozhiwei 2020-12-15 20:10:57 +08:00
parent 83240d6339
commit d9ceda09c8

View File

@ -1,12 +1,27 @@
'use strict'
const path = require('path')
const pkg = require('./package.json')
const os = require('os')
function resolve(dir) {
return path.join(__dirname, dir)
}
function getIPAdress() {
let interfaces = os.networkInterfaces()
for (let devName in interfaces) {
let iface = interfaces[devName]
for (let i = 0; i < iface.length; i++) {
let alias = iface[i]
if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) {
return alias.address
}
}
}
}
const name = pkg.name || 'vue-element-admin' // page title
const host = getIPAdress()
const port = 9527 // dev port
// All configuration item explanations can be find in https://cli.vuejs.org/config/
@ -24,6 +39,7 @@ module.exports = {
lintOnSave: process.env.NODE_ENV === 'development' ? 'error' : false,
productionSourceMap: false,
devServer: {
host: host,
port: port,
open: true,
overlay: {
@ -34,7 +50,7 @@ module.exports = {
// change xxx-api/login => mock/login
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: `http://localhost:${port}/mock`,
target: `http://${host}:${port}/mock`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''