mirror of
https://github.com/fantastic-admin/basic.git
synced 2026-10-07 15:28:36 +08:00
增加gzip支持
This commit is contained in:
+3
-1
@@ -3,7 +3,9 @@ VUE_APP_TITLE = Fantastic-admin 演示
|
||||
# 接口请求地址,会设置到 axios 的 baseURL 参数上
|
||||
VUE_APP_API_ROOT = /
|
||||
# 是否开启 CDN 支持,开启设置 ON,关闭设置 OFF
|
||||
# 详情介绍请阅读 http://eoner.gitee.io/vue-automation/#/cdn
|
||||
# 详情介绍请阅读 https://hooray.gitee.io/fantastic-admin/guide/cdn.html
|
||||
VUE_APP_CDN = OFF
|
||||
# 是否开启 gzip 压缩,开启设置 ON,关闭设置 OFF
|
||||
VUE_APP_GZIP = OFF
|
||||
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
|
||||
VUE_APP_DEBUG_TOOL =
|
||||
|
||||
+3
-1
@@ -9,7 +9,9 @@ VUE_APP_TITLE = 后台框架模版
|
||||
# 接口请求地址,会设置到 axios 的 baseURL 参数上
|
||||
VUE_APP_API_ROOT = /
|
||||
# 是否开启 CDN 支持,开启设置 ON,关闭设置 OFF
|
||||
# 详情介绍请阅读 http://eoner.gitee.io/vue-automation/#/cdn
|
||||
# 详情介绍请阅读 https://hooray.gitee.io/fantastic-admin/guide/cdn.html
|
||||
VUE_APP_CDN = OFF
|
||||
# 是否开启 gzip 压缩,开启设置 ON,关闭设置 OFF
|
||||
VUE_APP_GZIP = ON
|
||||
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
|
||||
VUE_APP_DEBUG_TOOL =
|
||||
|
||||
+3
-1
@@ -3,7 +3,9 @@ VUE_APP_TITLE = 后台框架模版
|
||||
# 接口请求地址,会设置到 axios 的 baseURL 参数上
|
||||
VUE_APP_API_ROOT = /
|
||||
# 是否开启 CDN 支持,开启设置 ON,关闭设置 OFF
|
||||
# 详情介绍请阅读 http://eoner.gitee.io/vue-automation/#/cdn
|
||||
# 详情介绍请阅读 https://hooray.gitee.io/fantastic-admin/guide/cdn.html
|
||||
VUE_APP_CDN = OFF
|
||||
# 是否开启 gzip 压缩,开启设置 ON,关闭设置 OFF
|
||||
VUE_APP_GZIP = ON
|
||||
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
|
||||
VUE_APP_DEBUG_TOOL =
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
"@winner-fed/vue-cli-plugin-stylelint": "^1.0.4",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.3",
|
||||
"compression-webpack-plugin": "^6.1.1",
|
||||
"eslint": "^7.12.1",
|
||||
"eslint-plugin-vue": "^7.1.0",
|
||||
"html-webpack-plugin": "^4.5.0",
|
||||
|
||||
@@ -2,6 +2,7 @@ const fs = require('fs')
|
||||
const path = require('path')
|
||||
const spritesmithPlugin = require('webpack-spritesmith')
|
||||
const terserPlugin = require('terser-webpack-plugin')
|
||||
const CompressionPlugin = require('compression-webpack-plugin')
|
||||
const cdnDependencies = require('./dependencies.cdn')
|
||||
|
||||
const spritesmithTasks = []
|
||||
@@ -48,6 +49,8 @@ const cdn = {
|
||||
css: cdnDependencies.map(e => e.css).filter(e => e),
|
||||
js: cdnDependencies.map(e => e.js).filter(e => e)
|
||||
}
|
||||
// gzip 相关
|
||||
const isGZIP = process.env.VUE_APP_GZIP == 'ON'
|
||||
|
||||
module.exports = {
|
||||
publicPath: '',
|
||||
@@ -92,6 +95,19 @@ module.exports = {
|
||||
})
|
||||
]
|
||||
}
|
||||
if (isGZIP) {
|
||||
return {
|
||||
plugins: [
|
||||
new CompressionPlugin({
|
||||
algorithm: 'gzip',
|
||||
test: /\.(js|css)$/, // 匹配文件名
|
||||
threshold: 10240, // 对超过10k的数据压缩
|
||||
deleteOriginalAssets: false, // 不删除源文件
|
||||
minRatio: 0.8 // 压缩比
|
||||
})
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
pluginOptions: {
|
||||
lintStyleOnBuild: true,
|
||||
|
||||
@@ -939,6 +939,13 @@
|
||||
"@nodelib/fs.scandir" "2.1.3"
|
||||
fastq "^1.6.0"
|
||||
|
||||
"@npmcli/move-file@^1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npm.taobao.org/@npmcli/move-file/download/@npmcli/move-file-1.0.1.tgz#de103070dac0f48ce49cf6693c23af59c0f70464"
|
||||
integrity sha1-3hAwcNrA9IzknPZpPCOvWcD3BGQ=
|
||||
dependencies:
|
||||
mkdirp "^1.0.4"
|
||||
|
||||
"@soda/friendly-errors-webpack-plugin@^1.7.1":
|
||||
version "1.7.1"
|
||||
resolved "https://registry.npm.taobao.org/@soda/friendly-errors-webpack-plugin/download/@soda/friendly-errors-webpack-plugin-1.7.1.tgz#706f64bcb4a8b9642b48ae3ace444c70334d615d"
|
||||
@@ -2326,6 +2333,29 @@ cacache@^13.0.1:
|
||||
ssri "^7.0.0"
|
||||
unique-filename "^1.1.1"
|
||||
|
||||
cacache@^15.0.5:
|
||||
version "15.0.5"
|
||||
resolved "https://registry.npm.taobao.org/cacache/download/cacache-15.0.5.tgz#69162833da29170d6732334643c60e005f5f17d0"
|
||||
integrity sha1-aRYoM9opFw1nMjNGQ8YOAF9fF9A=
|
||||
dependencies:
|
||||
"@npmcli/move-file" "^1.0.1"
|
||||
chownr "^2.0.0"
|
||||
fs-minipass "^2.0.0"
|
||||
glob "^7.1.4"
|
||||
infer-owner "^1.0.4"
|
||||
lru-cache "^6.0.0"
|
||||
minipass "^3.1.1"
|
||||
minipass-collect "^1.0.2"
|
||||
minipass-flush "^1.0.5"
|
||||
minipass-pipeline "^1.2.2"
|
||||
mkdirp "^1.0.3"
|
||||
p-map "^4.0.0"
|
||||
promise-inflight "^1.0.1"
|
||||
rimraf "^3.0.2"
|
||||
ssri "^8.0.0"
|
||||
tar "^6.0.2"
|
||||
unique-filename "^1.1.1"
|
||||
|
||||
cache-base@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npm.taobao.org/cache-base/download/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2"
|
||||
@@ -2542,6 +2572,11 @@ chownr@^1.1.1, chownr@^1.1.2:
|
||||
resolved "https://registry.npm.taobao.org/chownr/download/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b"
|
||||
integrity sha1-b8nXtC0ypYNZYzdmbn0ICE2izGs=
|
||||
|
||||
chownr@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.npm.taobao.org/chownr/download/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece"
|
||||
integrity sha1-Fb++U9LqtM9w8YqM1o6+Wzyx3s4=
|
||||
|
||||
chrome-trace-event@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npm.taobao.org/chrome-trace-event/download/chrome-trace-event-1.0.2.tgz#234090ee97c7d4ad1a2c4beae27505deffc608a4"
|
||||
@@ -2789,6 +2824,17 @@ compressible@~2.0.16:
|
||||
dependencies:
|
||||
mime-db ">= 1.43.0 < 2"
|
||||
|
||||
compression-webpack-plugin@^6.1.1:
|
||||
version "6.1.1"
|
||||
resolved "https://registry.npm.taobao.org/compression-webpack-plugin/download/compression-webpack-plugin-6.1.1.tgz#ae8e4b2ffdb7396bb776e66918d751a20d8ccf0e"
|
||||
integrity sha1-ro5LL/23OWu3duZpGNdRog2Mzw4=
|
||||
dependencies:
|
||||
cacache "^15.0.5"
|
||||
find-cache-dir "^3.3.1"
|
||||
schema-utils "^3.0.0"
|
||||
serialize-javascript "^5.0.1"
|
||||
webpack-sources "^1.4.3"
|
||||
|
||||
compression@^1.7.4:
|
||||
version "1.7.4"
|
||||
resolved "https://registry.npm.taobao.org/compression/download/compression-1.7.4.tgz#95523eff170ca57c29a0ca41e6fe131f41e5bb8f"
|
||||
@@ -6288,6 +6334,14 @@ minipass@^3.0.0, minipass@^3.1.1:
|
||||
dependencies:
|
||||
yallist "^4.0.0"
|
||||
|
||||
minizlib@^2.1.1:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.npm.taobao.org/minizlib/download/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931"
|
||||
integrity sha1-6Q00Zrogm5MkUVCKEc49NjIUWTE=
|
||||
dependencies:
|
||||
minipass "^3.0.0"
|
||||
yallist "^4.0.0"
|
||||
|
||||
mississippi@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.npm.taobao.org/mississippi/download/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022"
|
||||
@@ -6324,6 +6378,11 @@ mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.5, mkdirp@~0.5.1:
|
||||
dependencies:
|
||||
minimist "^1.2.5"
|
||||
|
||||
mkdirp@^1.0.3, mkdirp@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.npm.taobao.org/mkdirp/download/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
|
||||
integrity sha1-PrXtYmInVteaXw4qIh3+utdcL34=
|
||||
|
||||
mockjs@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.npm.taobao.org/mockjs/download/mockjs-1.1.0.tgz#e6a0c378e91906dbaff20911cc0273b3c7d75b06"
|
||||
@@ -6851,6 +6910,13 @@ p-map@^3.0.0:
|
||||
dependencies:
|
||||
aggregate-error "^3.0.0"
|
||||
|
||||
p-map@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.npm.taobao.org/p-map/download/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b"
|
||||
integrity sha1-uy+Vpe2i7BaOySdOBqdHw+KQTSs=
|
||||
dependencies:
|
||||
aggregate-error "^3.0.0"
|
||||
|
||||
p-retry@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.npm.taobao.org/p-retry/download/p-retry-3.0.1.tgz#316b4c8893e2c8dc1cfa891f406c4b422bebf328"
|
||||
@@ -8393,6 +8459,13 @@ serialize-javascript@^4.0.0:
|
||||
dependencies:
|
||||
randombytes "^2.1.0"
|
||||
|
||||
serialize-javascript@^5.0.1:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.npm.taobao.org/serialize-javascript/download/serialize-javascript-5.0.1.tgz?cache=0&sync_timestamp=1599740668657&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fserialize-javascript%2Fdownload%2Fserialize-javascript-5.0.1.tgz#7886ec848049a462467a97d3d918ebb2aaf934f4"
|
||||
integrity sha1-eIbshIBJpGJGepfT2Rjrsqr5NPQ=
|
||||
dependencies:
|
||||
randombytes "^2.1.0"
|
||||
|
||||
serve-index@^1.9.1:
|
||||
version "1.9.1"
|
||||
resolved "https://registry.npm.taobao.org/serve-index/download/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239"
|
||||
@@ -8758,6 +8831,13 @@ ssri@^7.0.0, ssri@^7.1.0:
|
||||
figgy-pudding "^3.5.1"
|
||||
minipass "^3.1.1"
|
||||
|
||||
ssri@^8.0.0:
|
||||
version "8.0.0"
|
||||
resolved "https://registry.npm.taobao.org/ssri/download/ssri-8.0.0.tgz#79ca74e21f8ceaeddfcb4b90143c458b8d988808"
|
||||
integrity sha1-ecp04h+M6u3fy0uQFDxFi42YiAg=
|
||||
dependencies:
|
||||
minipass "^3.1.1"
|
||||
|
||||
stable@^0.1.8:
|
||||
version "0.1.8"
|
||||
resolved "https://registry.npm.taobao.org/stable/download/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf"
|
||||
@@ -9206,6 +9286,18 @@ tapable@^1.0.0, tapable@^1.1.3:
|
||||
resolved "https://registry.npm.taobao.org/tapable/download/tapable-1.1.3.tgz?cache=0&sync_timestamp=1604917801052&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftapable%2Fdownload%2Ftapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
|
||||
integrity sha1-ofzMBrWNth/XpF2i2kT186Pme6I=
|
||||
|
||||
tar@^6.0.2:
|
||||
version "6.0.5"
|
||||
resolved "https://registry.npm.taobao.org/tar/download/tar-6.0.5.tgz?cache=0&sync_timestamp=1597445351863&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftar%2Fdownload%2Ftar-6.0.5.tgz#bde815086e10b39f1dcd298e89d596e1535e200f"
|
||||
integrity sha1-vegVCG4Qs58dzSmOidWW4VNeIA8=
|
||||
dependencies:
|
||||
chownr "^2.0.0"
|
||||
fs-minipass "^2.0.0"
|
||||
minipass "^3.0.0"
|
||||
minizlib "^2.1.1"
|
||||
mkdirp "^1.0.3"
|
||||
yallist "^4.0.0"
|
||||
|
||||
terser-webpack-plugin@^1.4.3:
|
||||
version "1.4.5"
|
||||
resolved "https://registry.npm.taobao.org/terser-webpack-plugin/download/terser-webpack-plugin-1.4.5.tgz?cache=0&sync_timestamp=1603881772144&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fterser-webpack-plugin%2Fdownload%2Fterser-webpack-plugin-1.4.5.tgz#a217aefaea330e734ffacb6120ec1fa312d6040b"
|
||||
|
||||
Reference in New Issue
Block a user