From 6796c50198ce80dd4eba7a4b0f877afc75568f2e Mon Sep 17 00:00:00 2001 From: SahinurDEV <68515168+SahinurDEV@users.noreply.github.com> Date: Wed, 18 Nov 2026 08:52:35 +0600 Subject: [PATCH] build(client): use the function form of manualChunks Vite 8 builds with Rolldown, which no longer accepts the object form of build.rollupOptions.output.manualChunks ("TypeError: manualChunks is not a function" on #92). The function form works on Vite 7 and 8 and keeps the same react-vendor/editor/dnd/query chunks. Signed-off-by: SahinurDEV <68515168+SahinurDEV@users.noreply.github.com> --- client/vite.config.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/client/vite.config.ts b/client/vite.config.ts index caf6a94..c818844 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -20,11 +20,22 @@ export default defineConfig({ output: { // Split heavy vendor libraries into their own chunks so the main // bundle stays small and chunks can be cached independently. - manualChunks: { - 'react-vendor': ['react', 'react-dom', 'react-router-dom'], - editor: ['@tiptap/react', '@tiptap/starter-kit'], - dnd: ['@dnd-kit/core', '@dnd-kit/sortable', '@dnd-kit/modifiers'], - query: ['@tanstack/react-query', '@tanstack/react-table'], + // Function form: Vite 8 (Rolldown) no longer accepts the object form. + manualChunks(id: string) { + if (!id.includes('node_modules')) return undefined; + if ( + /[\\/]node_modules[\\/](react|react-dom|react-router|react-router-dom|scheduler)[\\/]/.test( + id, + ) + ) + return 'react-vendor'; + if ( + /[\\/]node_modules[\\/](@tiptap|prosemirror-[^\\/]+)[\\/]/.test(id) + ) + return 'editor'; + if (/[\\/]node_modules[\\/]@dnd-kit[\\/]/.test(id)) return 'dnd'; + if (/[\\/]node_modules[\\/]@tanstack[\\/]/.test(id)) return 'query'; + return undefined; }, }, },