You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

68 lines
1.9 KiB

  1. /**
  2. * 配置参考:
  3. * https://cli.vuejs.org/zh/config/
  4. */
  5. // const url = 'http://pigx-gateway'
  6. // const url = 'http://39.97.167.65:9999' //测试
  7. // const url = 'http://192.168.31.167:9999' //长龙
  8. // const url = 'http://192.168.31.134:9999' //嘉豪
  9. // const url = 'http://192.168.31.100:9999' //王笑
  10. // const url = 'http://62.234.122.43:9999' //正式
  11. const url = 'https://zanyong.hfju.com' // 正式域名
  12. const CompressionWebpackPlugin = require('compression-webpack-plugin')
  13. const productionGzipExtensions = ['js', 'css']
  14. module.exports = {
  15. lintOnSave: true,
  16. productionSourceMap: false,
  17. chainWebpack: config => {
  18. const entry = config.entry('app')
  19. entry
  20. .add('babel-polyfill')
  21. .end()
  22. entry
  23. .add('classlist-polyfill')
  24. .end()
  25. },
  26. css: {
  27. // 忽略 CSS order 顺序警告
  28. extract: { ignoreOrder: true }
  29. },
  30. configureWebpack: (config) => {
  31. if (process.env.NODE_ENV === 'production') {
  32. // 仅在生产环境下启用该配置
  33. return {
  34. performance: {
  35. // 打包后最大文件大小限制
  36. maxAssetSize: 1024000
  37. },
  38. plugins: [
  39. new CompressionWebpackPlugin({
  40. // filename: '[path].gz[query]',
  41. // algorithm: 'gzip',
  42. // test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
  43. // threshold: 1024, // 只有大小大于该值的资源会被处理,当前配置为对于超过1k的数据进行处理,不足1k的可能会越压缩越大
  44. // minRatio: 0.99, // 只有压缩率小于这个值的资源才会被处理
  45. // deleteOriginalAssets: true // 删除原文件
  46. })
  47. ]
  48. }
  49. }
  50. },
  51. // 配置转发代理
  52. devServer: {
  53. disableHostCheck: true,
  54. port: 8080,
  55. proxy: {
  56. '/': {
  57. target: url,
  58. ws: false, // 需要websocket 开启
  59. pathRewrite: {
  60. '^/': '/'
  61. }
  62. },
  63. // 3.5 以后不需要再配置
  64. }
  65. }
  66. }