index.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. 'use strict'
  2. // Template version: 1.3.1
  3. // see http://vuejs-templates.github.io/webpack for documentation.
  4. const path = require('path')
  5. module.exports = {
  6. dev: {
  7. // Paths
  8. assetsSubDirectory: 'static',
  9. assetsPublicPath: '/',
  10. proxyTable: {
  11. '/api': {
  12. target: 'http://192.168.1.5:8000/',
  13. // target: 'http://192.168.1.120:8001/',
  14. changeOrigin: true,
  15. pathRewrite: {
  16. '^/api': '' //重写接口
  17. }
  18. },
  19. '/ChinaSciencesGroup': {
  20. target: 'http://47.99.110.100:8080/', //目标接口域名-中科院
  21. changeOrigin: true, //是否跨域
  22. pathRewrite: {
  23. '^/ChinaSciencesGroup': '' //重写接口
  24. }
  25. },
  26. '/v3': { //百度地图坐标转换
  27. target: 'http://api.map.baidu.com/reverse_geocoding/v3/',
  28. changeOrigin: true,
  29. pathRewrite: {
  30. '^/v3': '' //重写接口
  31. }
  32. },
  33. '/v4': { //搜狐IP地址查询接口(可设置编码)
  34. target: 'https://pv.sohu.com/cityjson?ie=utf-8',
  35. changeOrigin: true,
  36. pathRewrite: {
  37. '^/v4': '' //重写接口
  38. }
  39. },
  40. '/v5': { //查看天气
  41. target: 'http://wthrcdn.etouch.cn/weather_mini',
  42. changeOrigin: true,
  43. pathRewrite: {
  44. '^/v5': '' //重写接口
  45. }
  46. },
  47. },
  48. // Various Dev Server settings
  49. host: '192.168.1.10', // can be overwritten by process.env.HOST
  50. port: 8000, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  51. autoOpenBrowser: false,
  52. errorOverlay: true,
  53. notifyOnErrors: true,
  54. poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  55. /**
  56. * Source Maps
  57. */
  58. // https://webpack.js.org/configuration/devtool/#development
  59. devtool: 'cheap-module-eval-source-map',
  60. // If you have problems debugging vue-files in devtools,
  61. // set this to false - it *may* help
  62. // https://vue-loader.vuejs.org/en/options.html#cachebusting
  63. cacheBusting: true,
  64. cssSourceMap: true
  65. },
  66. build: {
  67. // Template for index.html
  68. index: path.resolve(__dirname, '../dist/index.html'),
  69. // Paths
  70. assetsRoot: path.resolve(__dirname, '../dist'),
  71. assetsSubDirectory: 'static',
  72. assetsPublicPath: '/',
  73. /**
  74. * Source Maps
  75. */
  76. productionSourceMap: true,
  77. // https://webpack.js.org/configuration/devtool/#production
  78. devtool: '#source-map',
  79. // Gzip off by default as many popular static hosts such as
  80. // Surge or Netlify already gzip all static assets for you.
  81. // Before setting to `true`, make sure to:
  82. // npm install --save-dev compression-webpack-plugin
  83. productionGzip: true,
  84. productionGzipExtensions: ['js', 'css'],
  85. // Run the build command with an extra argument to
  86. // View the bundle analyzer report after build finishes:
  87. // `npm run build --report`
  88. // Set to `true` or `false` to always turn it on or off
  89. bundleAnalyzerReport: process.env.npm_config_report
  90. }
  91. }