Skip to content

Commit

Permalink
perf(gatsby): Minify page-data (#35578)
Browse files Browse the repository at this point in the history
Co-authored-by: Lennart <lekoarts@gmail.com>
  • Loading branch information
me4502 and LekoArts committed May 5, 2022
1 parent 39e9840 commit 8bad9b3
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions packages/gatsby/src/utils/page-data-helpers.ts
Expand Up @@ -20,20 +20,19 @@ export function constructPageDataString(
}: IPageData,
result: string | Buffer
): string {
let body = `{
"componentChunkName": "${componentChunkName}",
"path": ${JSON.stringify(pagePath)},
"result": ${result},
"staticQueryHashes": ${JSON.stringify(staticQueryHashes)}`
let body =
`{` +
`"componentChunkName":"${componentChunkName}",` +
`"path":${JSON.stringify(pagePath)},` +
`"result":${result},` +
`"staticQueryHashes":${JSON.stringify(staticQueryHashes)}`

if (matchPath) {
body += `,
"matchPath": "${matchPath}"`
body += `,"matchPath":"${matchPath}"`
}

if (manifestId) {
body += `,
"manifestId": "${manifestId}"`
body += `,"manifestId":"${manifestId}"`
}

body += `}`
Expand Down

0 comments on commit 8bad9b3

Please sign in to comment.