feat(vite): allow disabling entry warmup (#6647)

* feat(vite): allow opt-out from warming up entries

* refactor: move to `warmupEntry`
This commit is contained in:
pooya parsa 2022-08-15 18:01:34 +02:00 committed by GitHub
parent e2745f6d75
commit dae836a81d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -49,5 +49,9 @@ export interface ViteConfig extends ViteUserConfig {
* Bundler for dev time server-side rendering.
* @default 'vite-node'
*/
devBundler?: 'vite-node' | 'legacy'
devBundler?: 'vite-node' | 'legacy',
/**
* Warmup vite entrypoint caches on dev startup.
*/
warmupEntry?: boolean
}

View File

@ -101,10 +101,12 @@ export async function bundle (nuxt: Nuxt) {
}
})
const start = Date.now()
warmupViteServer(server, [join('/@fs/', ctx.entry)])
.then(() => logger.info(`Vite ${env.isClient ? 'client' : 'server'} warmed up in ${Date.now() - start}ms`))
.catch(logger.error)
if (nuxt.options.vite.warmupEntry !== false) {
const start = Date.now()
warmupViteServer(server, [join('/@fs/', ctx.entry)])
.then(() => logger.info(`Vite ${env.isClient ? 'client' : 'server'} warmed up in ${Date.now() - start}ms`))
.catch(logger.error)
}
})
await buildClient(ctx)