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.
 
 
 

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