添加linux server模型下调试zhic
This commit is contained in:
parent
83240d6339
commit
d9ceda09c8
@ -1,12 +1,27 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const pkg = require('./package.json')
|
const pkg = require('./package.json')
|
||||||
|
const os = require('os')
|
||||||
|
|
||||||
function resolve(dir) {
|
function resolve(dir) {
|
||||||
return path.join(__dirname, 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 name = pkg.name || 'vue-element-admin' // page title
|
||||||
|
const host = getIPAdress()
|
||||||
const port = 9527 // dev port
|
const port = 9527 // dev port
|
||||||
|
|
||||||
// All configuration item explanations can be find in https://cli.vuejs.org/config/
|
// 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,
|
lintOnSave: process.env.NODE_ENV === 'development' ? 'error' : false,
|
||||||
productionSourceMap: false,
|
productionSourceMap: false,
|
||||||
devServer: {
|
devServer: {
|
||||||
|
host: host,
|
||||||
port: port,
|
port: port,
|
||||||
open: true,
|
open: true,
|
||||||
overlay: {
|
overlay: {
|
||||||
@ -34,7 +50,7 @@ module.exports = {
|
|||||||
// change xxx-api/login => mock/login
|
// change xxx-api/login => mock/login
|
||||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||||
[process.env.VUE_APP_BASE_API]: {
|
[process.env.VUE_APP_BASE_API]: {
|
||||||
target: `http://localhost:${port}/mock`,
|
target: `http://${host}:${port}/mock`,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user