From 851fb27c32af5a32efbe276f58ead7e4604ba15f Mon Sep 17 00:00:00 2001 From: Ray-D-Song Date: Thu, 31 Oct 2024 17:58:46 +0800 Subject: [PATCH] chore: chunk optimization --- .github/workflows/preview-service.yml | 2 +- packages/web/vite.config.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/preview-service.yml b/.github/workflows/preview-service.yml index 8d2ee3d..e8a758a 100644 --- a/.github/workflows/preview-service.yml +++ b/.github/workflows/preview-service.yml @@ -3,9 +3,9 @@ name: Deploy-Preview on: push: branches: - - dev - main - hotfix + - chunk jobs: deploy: diff --git a/packages/web/vite.config.ts b/packages/web/vite.config.ts index ded545a..fe83070 100644 --- a/packages/web/vite.config.ts +++ b/packages/web/vite.config.ts @@ -24,6 +24,12 @@ export default defineConfig({ output: { entryFileNames: 'index.js', assetFileNames: 'index.css', + chunkFileNames: 'assets/[name]-[hash].js', + manualChunks: { + 'react-vendor': ['react', 'react-dom', 'react-router-dom'], + 'radix-ui': ['@radix-ui/react-checkbox', '@radix-ui/react-collapsible', '@radix-ui/react-context-menu', '@radix-ui/react-dialog', '@radix-ui/react-dropdown-menu', '@radix-ui/react-label', '@radix-ui/react-scroll-area', '@radix-ui/react-select', '@radix-ui/react-separator', '@radix-ui/react-slot', '@radix-ui/react-switch', '@radix-ui/react-tooltip'], + 'recharts': ['recharts'], + }, }, }, outDir: '../../dist/service/src/static',