index.js 2.2 KB

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