From 61b1c8ca2d482dad0ba37401b7dfe56142bb1c6a Mon Sep 17 00:00:00 2001 From: ddCat <2695092045@qq.com> Date: Mon, 14 Sep 2026 20:32:17 +0800 Subject: [PATCH] =?UTF-8?q?perf(web):=20=E4=BC=98=E5=8C=96=E9=9D=99?= =?UTF-8?q?=E6=80=81=E8=B5=84=E6=BA=90=E7=BC=93=E5=AD=98=E4=B8=8E=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=88=86=E5=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx.conf | 9 +++++++++ web/vite.config.ts | 14 ++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/nginx.conf b/nginx.conf index 555c4dede..270705bd3 100644 --- a/nginx.conf +++ b/nginx.conf @@ -23,6 +23,15 @@ server { gzip_vary on; gzip_types application/json application/javascript text/css text/plain image/svg+xml; + # Vite assets use content hashes, so they are safe to cache across deployments. + # Keep index.html uncached below so it always points to the current asset manifest. + location ^~ /assets/ { + access_log off; + try_files $uri =404; + expires 1y; + add_header Cache-Control "public, max-age=31536000, immutable" always; + } + location ^~ /api/public/canvas-shares/ { access_log off; proxy_pass http://backend:8080; diff --git a/web/vite.config.ts b/web/vite.config.ts index 2b8777311..e176694de 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -40,8 +40,10 @@ export default defineConfig({ output: { strictExecutionOrder: true, codeSplitting: { - includeDependenciesRecursively: true, - minSize: 20 * 1024, + // Keep route-level lazy imports isolated. Recursively merging dependencies + // pulls unrelated pages into the initial modulepreload graph. + includeDependenciesRecursively: false, + minSize: 40 * 1024, groups: [ { name: "vendor-react", @@ -62,14 +64,6 @@ export default defineConfig({ entriesAware: true, entriesAwareMergeThreshold: 80 * 1024, }, - { - name: "app-shared", - test: /[\\/]src[\\/]/, - priority: 5, - minShareCount: 2, - entriesAware: true, - entriesAwareMergeThreshold: 48 * 1024, - }, ], }, },