vue.config.js 800 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * @Author: PoJun
  3. * @Date: 2024-03-14 17:01:20
  4. * @LastEditors: PoJun
  5. * @LastEditTime: 2024-04-15 11:33:37
  6. * @Message: Nothing
  7. */
  8. const CompressionPlugin = require('compression-webpack-plugin');
  9. module.exports = {
  10. productionSourceMap: false,
  11. devServer: {
  12. open: true,
  13. hot: false,
  14. inline: false,
  15. liveReload: false,
  16. },
  17. css: {
  18. // 是否开启 CSS source maps
  19. sourceMap: false,
  20. requireModuleExtension: true,
  21. },
  22. configureWebpack: () => {
  23. if (process.env.NODE_ENV === 'production') {
  24. return {
  25. plugins: [
  26. new CompressionPlugin({
  27. test: /\.js$|\.css/, // 匹配文件名字
  28. threshold: 10240, // 对超过10k的数据进行压缩
  29. deleteOriginalAssets: false, // 是否删除源文件
  30. }),
  31. ],
  32. };
  33. }
  34. },
  35. };