1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- var path = require('path')
- var os = require('os'), ip = '', ifaces = os.networkInterfaces() // 获取本机ip
- for (var i in ifaces) {
- for (var j in ifaces[i]) {
- var val = ifaces[i][j]
- if (val.family === 'IPv4' && val.address !== '127.0.0.1') {
- ip = val.address
- }
- }
- }
- module.exports = {
- build: {
- env: require('./prod.env'),
- index: path.resolve(__dirname, '../dist/index.html'),
- assetsRoot: path.resolve(__dirname, '../dist'),
- assetsSubDirectory: 'static',
- assetsPublicPath: './',
- productionSourceMap: true,
- productionGzip: false,
- productionGzipExtensions: ['js', 'css'],
- bundleAnalyzerReport: process.env.npm_config_report
- },
- dev: {
- env: require('./dev.env'),
- port: 8001,
- autoOpenBrowser: true,
- assetsSubDirectory: 'static',
- assetsPublicPath: '/',
- proxyTable: {
- '/api': {
- target: 'http://'+ ip +':9099', // 接口域名 开发
- secure: true, // 如果是https接口,需要配置这个参数
- changeOrigin: true, //是否跨域
- pathRewrite: { // 如果接口本身没有api的路径,那么这里将发送到后端的请求重写为没有api的路径
- '^/api': '/'
- }
- },
- '/ips': {
- target: 'http://'+ ip +':8080', // 接口域名 开发
- secure: true, // 如果是https接口,需要配置这个参数
- changeOrigin: true, //是否跨域
- pathRewrite: { // 如果接口本身没有api的路径,那么这里将发送到后端的请求重写为没有api的路径
- '^/ips': '/'
- }
- },
- },
- cssSourceMap: false
- }
- }
|