From 26cb685adf54f07fe3e9fd7bfd49a0ff79956923 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Wed, 7 May 2025 16:30:50 +0530 Subject: [PATCH] fix(build): emit lean chunks after vite has done processing closes #4737 Co-authored-by: green --- src/node/plugin.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/node/plugin.ts b/src/node/plugin.ts index f6c3d3f9..791b499f 100644 --- a/src/node/plugin.ts +++ b/src/node/plugin.ts @@ -353,14 +353,18 @@ export async function createVitePressPlugin( return null }, - generateBundle(_options, bundle) { - if (ssr) { - this.emitFile({ - type: 'asset', - fileName: 'package.json', - source: '{ "private": true, "type": "module" }' - }) - } else { + generateBundle: { + order: ssr ? null : 'post', + handler(_options, bundle) { + if (ssr) { + this.emitFile({ + type: 'asset', + fileName: 'package.json', + source: '{ "private": true, "type": "module" }' + }) + return + } + // client build: // for each .md entry chunk, adjust its name to its correct path. for (const name in bundle) {