Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

feat(vite): allow disabling entry warmup #6647

Merged
merged 2 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/schema/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
10 changes: 6 additions & 4 deletions packages/vite/src/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down