index.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. var path = require('path')
  2. // var ip = '192.168.2.12'
  3. // var ip = '47.101.180.183'
  4. // var ip = '47.100.37.243'
  5. // var ip = '192.168.10.2'
  6. // var ip = '192.168.2.3'
  7. var os = require('os'), ip = '', ifaces = os.networkInterfaces() // 获取本机ip
  8. for (var i in ifaces) {
  9. for (var j in ifaces[i]) {
  10. var val = ifaces[i][j]
  11. if (val.family === 'IPv4' && val.address !== '127.0.0.1') {
  12. ip = val.address
  13. }
  14. }
  15. }
  16. // 1196735749
  17. module.exports = {
  18. build: {
  19. env: require('./prod.env'),
  20. index: path.resolve(__dirname, '../dist/index.html'),
  21. assetsRoot: path.resolve(__dirname, '../dist'),
  22. assetsSubDirectory: 'static',
  23. assetsPublicPath: './',
  24. productionSourceMap: false,
  25. productionGzip: false,
  26. productionGzipExtensions: ['js', 'css'],
  27. bundleAnalyzerReport: process.env.npm_config_report
  28. },
  29. dev: {
  30. env: require('./dev.env'),
  31. port: 10086,
  32. autoOpenBrowser: true,
  33. assetsSubDirectory: 'static',
  34. assetsPublicPath: '/',
  35. proxyTable: {
  36. // '/api/permission': {
  37. // target: 'http://' + ip + ':2022',
  38. // pathRewrite: {'^api': '/'}
  39. // },
  40. // '/api/user': {
  41. // target: 'http://' + ip + ':10010',
  42. // pathRewrite: {'^api': '/'}
  43. // }
  44. // '/api/permission': {
  45. // target: 'http://'+ ip +':2022',
  46. // secure: true,
  47. // changeOrigin: true,
  48. // pathRewrite: {
  49. // '^/api': '/'
  50. // }
  51. // },
  52. '/api': {
  53. target: 'http://'+ ip +':10010',
  54. secure: true,
  55. changeOrigin: true,
  56. pathRewrite: {
  57. '^/api': '/'
  58. }
  59. },
  60. // '/ips': {
  61. // target: 'http://'+ ip +':8080',
  62. // secure: true,
  63. // changeOrigin: true,
  64. // pathRewrite: {
  65. // '^/ips': '/'
  66. // }
  67. // },
  68. },
  69. cssSourceMap: false
  70. }
  71. }