vue.config.js 1002 B

1234567891011121314151617181920212223242526272829303132333435
  1. // 导入compression-webpack-plugin
  2. const CompressionWebpackPlugin = require("compression-webpack-plugin");
  3. // 定义压缩文件类型
  4. const productionGzipExtensions = ["js", "css"];
  5. module.exports = {
  6. configureWebpack: config => {
  7. config.externals = {
  8. vue: "Vue",
  9. vuex: "Vuex",
  10. axios: "axios",
  11. CryptoJS: "CryptoJS",
  12. Qs: "Qs",
  13. moment: "moment",
  14. html2canvas: "html2canvas",
  15. QRCode: "QRCode",
  16. "vue-router": "VueRouter",
  17. "element-ui": "ELEMENT",
  18. vuePhotoPreview: "vuePhotoPreview"
  19. };
  20. config.plugins.push(
  21. new CompressionWebpackPlugin({
  22. filename: "[path].gz[query]",
  23. algorithm: "gzip",
  24. test: new RegExp("\\.(" + productionGzipExtensions.join("|") + ")$"),
  25. threshold: 10240,
  26. deleteOriginalAssets: false,
  27. minRatio: 0.8
  28. })
  29. );
  30. },
  31. publicPath: "/oms/"
  32. // publicPath: process.env.VUE_APP_ENV === "prod" ?
  33. // "//static.hoolihome.com/admin/oms/" : "/oms/"
  34. };