From 6f3a96f06daec4baad4420b54137a7afb1512e7f Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 6 Jan 2022 15:54:38 +0800 Subject: [PATCH] perf: do not include head config in client bundle for production --- src/node/plugin.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/node/plugin.ts b/src/node/plugin.ts index 7853d5c0..fc6d8e6f 100644 --- a/src/node/plugin.ts +++ b/src/node/plugin.ts @@ -122,7 +122,12 @@ export function createVitePressPlugin( load(id) { if (id === SITE_DATA_REQUEST_PATH) { - return `export default ${JSON.stringify(JSON.stringify(siteData))}` + let data = siteData + // head info is not needed by the client in production build + if (config.command === 'build') { + data = { ...siteData, head: [] } + } + return `export default ${JSON.stringify(JSON.stringify(data))}` } },