Skip to content

Commit

Permalink
perf: do not include head config in client bundle for production
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 6, 2022
1 parent c3b6f68 commit 6f3a96f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/node/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))}`
}
},

Expand Down

0 comments on commit 6f3a96f

Please sign in to comment.