index.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // see http://vuejs-templates.github.io/webpack for documentation.
  2. var path = require('path')
  3. var buildEnv = require('./prod.env')
  4. var devEnv = require('./dev.env')
  5. //所有代理配置
  6. const proxyTable = {
  7. '/api': {
  8. target: 'http://192.168.20.236:8080', //数据中心测试环境
  9. changeOrigin: true,
  10. pathRewrite: {
  11. "^/api": "/"
  12. }
  13. },
  14. '/physics': {
  15. target: 'http://192.168.20.225:8080', //物理世界
  16. changeOrigin: true,
  17. pathRewrite: {
  18. '^/physics': ''
  19. }
  20. },
  21. '/echarts': {
  22. target: 'http://101.201.234.108:28888', //echarts数据
  23. changeOrigin: true,
  24. pathRewrite: {
  25. '^/echarts': ''
  26. }
  27. },
  28. '/img': {
  29. target: 'http://192.168.20.225:8080',
  30. changeOrigin: true,
  31. pathRewrite: {
  32. '^/img': ''
  33. }
  34. }
  35. }
  36. module.exports = {
  37. build: {
  38. env: buildEnv,
  39. index: path.resolve(__dirname, '../dist/index.html'),
  40. assetsRoot: path.resolve(__dirname, '../dist'),
  41. assetsSubDirectory: '',
  42. assetsPublicPath: '/',
  43. staticPath: './', //生产环境 staticPath:''
  44. productionSourceMap: true,
  45. // Gzip off by default as many popular static hosts such as
  46. // Surge or Netlify already gzip all static assets for you.
  47. // Before setting to `true`, make sure to:
  48. // npm install --save-dev compression-webpack-plugin
  49. productionGzip: false,
  50. productionGzipExtensions: ['js', 'css'],
  51. // Run the build command with an extra argument to
  52. // View the bundle analyzer report after build finishes:
  53. // `npm run build --report`
  54. // Set to `true` or `false` to always turn it on or off
  55. bundleAnalyzerReport: process.env.npm_config_report
  56. },
  57. dev: {
  58. env: devEnv,
  59. autoOpenBrowser: true,
  60. assetsSubDirectory: '',
  61. assetsPublicPath: '/',
  62. staticPath: '/',
  63. proxyTable: proxyTable,
  64. // CSS Sourcemaps off by default because relative paths are "buggy"
  65. // with this option, according to the CSS-Loader README
  66. // (https://github.com/webpack/css-loader#sourcemaps)
  67. // In our experience, they generally work as expected,
  68. // just be aware of this issue when enabling this option.
  69. cssSourceMap: false
  70. }
  71. }