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.

vue.config.js 1.9 KiB

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