Skip to content

Commit

Permalink
perf(vite): avoid duplicate JSON.stringify operation (#24848)
Browse files Browse the repository at this point in the history
  • Loading branch information
GalacticHypernova committed Dec 21, 2023
1 parent b589314 commit 59cac48
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/vite/src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ export async function writeManifest (ctx: ViteBuildContext, css: string[] = [])

const manifest = normalizeViteManifest(clientManifest)
await ctx.nuxt.callHook('build:manifest', manifest)

await fse.writeFile(resolve(serverDist, 'client.manifest.json'), JSON.stringify(manifest, null, 2), 'utf8')
await fse.writeFile(resolve(serverDist, 'client.manifest.mjs'), 'export default ' + JSON.stringify(manifest, null, 2), 'utf8')
const stringifiedManifest = JSON.stringify(manifest, null, 2)
await fse.writeFile(resolve(serverDist, 'client.manifest.json'), stringifiedManifest, 'utf8')
await fse.writeFile(resolve(serverDist, 'client.manifest.mjs'), 'export default ' + stringifiedManifest, 'utf8')

if (!ctx.nuxt.options.dev) {
await fse.rm(manifestFile, { force: true })
Expand Down

0 comments on commit 59cac48

Please sign in to comment.