在config里面的index.js
const path = require('path')
const address = require('address');
console.log(address)
const network = 'http://' + address .ip() || 'http://localhost' // 需要更改的ip
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {
'/api': {
target: network
}
},
// Various Dev Server settings
host: network, // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined