Skip to content

Commit 1bdbfa6

Browse files
SkyeYoungCopilot
andauthored
feat: generate gzip assets during build (#3178)
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
1 parent cf9444e commit 1bdbfa6

File tree

4 files changed

+49
-3
lines changed

4 files changed

+49
-3
lines changed

e2e/server/nginx.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ server {
1919
listen 6174;
2020

2121
location /ui {
22-
rewrite ^/ui$ /ui/ permanent;
22+
rewrite ^/ui$ /ui/ permanent;
2323
}
2424

2525
location /ui/ {
2626
alias /usr/share/nginx/html/;
27-
index index.html;
28-
try_files $uri $uri/ /ui/index.html;
27+
gzip_static always;
28+
error_page 404 /ui/index.html;
2929
}
3030

3131
location / {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"unplugin-icons": "^22.1.0",
9090
"unplugin-info": "^1.2.2",
9191
"vite": "^6.3.5",
92+
"vite-plugin-compression2": "^2.2.0",
9293
"vite-tsconfig-paths": "^5.1.4",
9394
"yaml": "^2.7.1"
9495
},

pnpm-lock.yaml

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vite.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import postcssSimpleVars from 'postcss-simple-vars';
2222
import UnpluginIcons from 'unplugin-icons/vite';
2323
import UnpluginInfo from 'unplugin-info/vite';
2424
import { defineConfig } from 'vite';
25+
import { compression } from 'vite-plugin-compression2';
2526
import tsconfigPaths from 'vite-tsconfig-paths';
2627

2728
import { API_PREFIX, BASE_PATH } from './src/config/constant';
@@ -83,6 +84,10 @@ export default defineConfig({
8384
react({
8485
plugins: [observerPlugin() as never],
8586
}),
87+
compression({
88+
algorithms: ['gzip'],
89+
deleteOriginalAssets: true,
90+
}),
8691
],
8792
css: {
8893
postcss: {

0 commit comments

Comments
 (0)