From f3d6279d29230c2e8345e1f40d716fdc8a2a35f3 Mon Sep 17 00:00:00 2001 From: Tristan Chin Date: Sun, 16 Jul 2023 00:35:12 -0400 Subject: [PATCH] [web] Improve bundle chunks --- packages/web/src/changelog/v4-4-1.ts | 2 +- packages/web/vite.config.ts | 35 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/packages/web/src/changelog/v4-4-1.ts b/packages/web/src/changelog/v4-4-1.ts index 550611d..d12373d 100644 --- a/packages/web/src/changelog/v4-4-1.ts +++ b/packages/web/src/changelog/v4-4-1.ts @@ -10,7 +10,7 @@ const v4_4_1: ChangelogEntry = { items: [ "Further improved state management", "Reduced initial bundle size", - "Update app dependencies", + "Updated all project dependencies", ], }, ], diff --git a/packages/web/vite.config.ts b/packages/web/vite.config.ts index 4a6904b..ace978a 100644 --- a/packages/web/vite.config.ts +++ b/packages/web/vite.config.ts @@ -49,6 +49,41 @@ export default defineConfig({ define: { APP_VERSION: JSON.stringify(process.env.npm_package_version), }, + build: { + rollupOptions: { + output: { + manualChunks: { + "mantine-core": [ + "@mantine/core", + "@mantine/hooks", + "@emotion/react", + ], + "mantine-dropzone": ["@mantine/dropzone"], + "mantine-form": ["@mantine/form"], + "mantine-modals": ["@mantine/modals"], + "mantine-notifications": ["@mantine/notifications"], + "mantine-prism": ["@mantine/prism"], + "mantine-tiptap": [ + "@tiptap/extension-code-block-lowlight", + "@tiptap/extension-link", + "@tiptap/react", + "@tiptap/starter-kit", + "@mantine/tiptap", + "@tabler/icons-react", + "lowlight", + ], + "gpt-turbo": ["gpt-turbo"], + react: ["react"], + "react-dom": ["react-dom"], + "react-icons": ["react-icons"], + "react-router-dom": ["react-router-dom"], + uuid: ["uuid"], + zod: ["zod"], + zustand: ["zustand"], + }, + }, + }, + }, server: { port: 3000, host: true,