index.js 1.9 KB

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