Skip to content

Commit

Permalink
perf(vite): avoid duplicate resolve operation (#24736)
Browse files Browse the repository at this point in the history
  • Loading branch information
GalacticHypernova committed Dec 14, 2023
1 parent 1bf1edf commit 62df8f0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/vite/src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ export async function writeManifest (ctx: ViteBuildContext, css: string[] = [])
}
}

const manifestFile = resolve(clientDist, 'manifest.json')
const clientManifest = ctx.nuxt.options.dev
? devClientManifest
: await fse.readJSON(resolve(clientDist, 'manifest.json'))
: await fse.readJSON(manifestFile)

const buildAssetsDir = withTrailingSlash(withoutLeadingSlash(ctx.nuxt.options.app.buildAssetsDir))
const BASE_RE = new RegExp(`^${escapeRE(buildAssetsDir)}`)
Expand Down Expand Up @@ -63,6 +64,6 @@ export async function writeManifest (ctx: ViteBuildContext, css: string[] = [])
await fse.writeFile(resolve(serverDist, 'client.manifest.mjs'), 'export default ' + JSON.stringify(manifest, null, 2), 'utf8')

if (!ctx.nuxt.options.dev) {
await fse.rm(resolve(clientDist, 'manifest.json'), { force: true })
await fse.rm(manifestFile, { force: true })
}
}

0 comments on commit 62df8f0

Please sign in to comment.