mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-30 12:55:37 +00:00
perf: 优化编译命令
This commit is contained in:
parent
1b223f0486
commit
91e04a8d18
10
nginx.conf
10
nginx.conf
@ -1,6 +1,16 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_min_length 1k;
|
||||||
|
gzip_buffers 4 16k;
|
||||||
|
#gzip_http_version 1.0;
|
||||||
|
gzip_comp_level 8;
|
||||||
|
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
|
||||||
|
gzip_vary off;
|
||||||
|
gzip_static on;
|
||||||
|
gzip_disable "MSIE [1-6].";
|
||||||
|
|
||||||
location /ui/ {
|
location /ui/ {
|
||||||
try_files $uri / /ui/index.html;
|
try_files $uri / /ui/index.html;
|
||||||
alias /opt/lina/;
|
alias /opt/lina/;
|
||||||
|
@ -73,6 +73,7 @@
|
|||||||
"babel-eslint": "10.0.1",
|
"babel-eslint": "10.0.1",
|
||||||
"babel-jest": "23.6.0",
|
"babel-jest": "23.6.0",
|
||||||
"chalk": "2.4.2",
|
"chalk": "2.4.2",
|
||||||
|
"compression-webpack-plugin": "^6.1.1",
|
||||||
"connect": "3.6.6",
|
"connect": "3.6.6",
|
||||||
"element-theme-chalk": "^2.13.1",
|
"element-theme-chalk": "^2.13.1",
|
||||||
"eslint": "^5.15.3",
|
"eslint": "^5.15.3",
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const defaultSettings = require('./src/settings.js')
|
const defaultSettings = require('./src/settings.js')
|
||||||
|
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
||||||
|
const productionGzipExtensions = /\.(js|css|json|txt|ico|svg)(\?.*)?$/i
|
||||||
|
|
||||||
|
|
||||||
function resolve(dir) {
|
function resolve(dir) {
|
||||||
return path.join(__dirname, dir)
|
return path.join(__dirname, dir)
|
||||||
@ -82,7 +85,15 @@ module.exports = {
|
|||||||
alias: {
|
alias: {
|
||||||
'@': resolve('src')
|
'@': resolve('src')
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
plugins: [
|
||||||
|
new CompressionWebpackPlugin({
|
||||||
|
algorithm: 'gzip',
|
||||||
|
test: productionGzipExtensions, // 处理所有匹配此 {RegExp} 的资源
|
||||||
|
threshold: 10240, // 只处理比这个值大的资源。按字节计算(楼主设置10K以上进行压缩)
|
||||||
|
minRatio: 0.8 // 只有压缩率比这个值小的资源才会被处理
|
||||||
|
})
|
||||||
|
]
|
||||||
},
|
},
|
||||||
chainWebpack(config) {
|
chainWebpack(config) {
|
||||||
// it can improve the speed of the first screen, it is recommended to turn on preload
|
// it can improve the speed of the first screen, it is recommended to turn on preload
|
||||||
|
Loading…
Reference in New Issue
Block a user