From e730f6400395d4b5ba680b0646ca741648c388b0 Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Wed, 7 Oct 2026 12:13:56 +1100 Subject: [PATCH] perf(build): split the vendor chunk by the pages that use it vendor-shared held 692 kB raw on every page, including reka-ui menus, selects and hover cards that only some pages open. What the app entry imports stays in vendor-shared; the rest splits by the set of pages importing it. --- nuxt.config.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/nuxt.config.ts b/nuxt.config.ts index 6e1d5d49..99649813 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -795,12 +795,29 @@ export default defineNuxtConfig({ // imports with it, and its ContentRenderer imports every content // component, so the Skill card, the package setup form and zod // (through that form) rode in this chunk on every page. + // + // Two groups, so a page loads only the vendor code it uses. + // `vendor-shared` holds what the app entry imports, which every + // page runs. `vendor-lazy` holds the rest, such as the reka-ui + // menus, selects and hover cards only some pages open. It splits + // by the set of pages that import each module, and folds sets + // under 20 kB into a neighbour, so a launch page gains 4 to 8 + // files. One chunk held 692 kB raw on every page. groups: [ { name: 'vendor-shared', test: (id: string) => id.includes('node_modules') && !LAZY_ONLY_VENDOR.test(id), + tags: ['$initial'], + minShareCount: 2, + maxModuleSize: 8 * 1024, + }, + { + name: 'vendor-lazy', + test: (id: string) => id.includes('node_modules') && !LAZY_ONLY_VENDOR.test(id), minShareCount: 2, maxModuleSize: 8 * 1024, + entriesAware: true, + entriesAwareMergeThreshold: 20 * 1024, }, ], },