mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(vite): warmup server entries with ssr
condition (#6649)
This commit is contained in:
parent
dae836a81d
commit
58c4753ed4
@ -3,7 +3,8 @@ import type { ViteDevServer } from 'vite'
|
||||
|
||||
export async function warmupViteServer (
|
||||
server: ViteDevServer,
|
||||
entries: string[]
|
||||
entries: string[],
|
||||
isServer: boolean
|
||||
) {
|
||||
const warmedUrls = new Set<String>()
|
||||
|
||||
@ -13,7 +14,7 @@ export async function warmupViteServer (
|
||||
}
|
||||
warmedUrls.add(url)
|
||||
try {
|
||||
await server.transformRequest(url)
|
||||
await server.transformRequest(url, { ssr: isServer })
|
||||
} catch (e) {
|
||||
logger.debug('Warmup for %s failed with: %s', url, e)
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ export async function bundle (nuxt: Nuxt) {
|
||||
|
||||
if (nuxt.options.vite.warmupEntry !== false) {
|
||||
const start = Date.now()
|
||||
warmupViteServer(server, [join('/@fs/', ctx.entry)])
|
||||
warmupViteServer(server, [join('/@fs/', ctx.entry)], env.isServer)
|
||||
.then(() => logger.info(`Vite ${env.isClient ? 'client' : 'server'} warmed up in ${Date.now() - start}ms`))
|
||||
.catch(logger.error)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user