From 1cc83205a5fc8a3f70ae6e8524fd8f24f1b476cb Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Fri, 29 Jul 2022 18:12:26 +0800 Subject: [PATCH] perf(vite): remove vite warm up --- packages/vite/src/vite.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/vite/src/vite.ts b/packages/vite/src/vite.ts index 28cc05527ed..371053bd3dd 100644 --- a/packages/vite/src/vite.ts +++ b/packages/vite/src/vite.ts @@ -2,14 +2,13 @@ import * as vite from 'vite' import { resolve } from 'pathe' import type { Nuxt } from '@nuxt/schema' import type { InlineConfig, SSROptions } from 'vite' -import { logger, isIgnored } from '@nuxt/kit' +import { isIgnored } from '@nuxt/kit' import type { Options } from '@vitejs/plugin-vue' import replace from '@rollup/plugin-replace' import { sanitizeFilePath } from 'mlly' import { buildClient } from './client' import { buildServer } from './server' import virtual from './plugins/virtual' -import { warmupViteServer } from './utils/warmup' import { resolveCSSOptions } from './css' import { composableKeysPlugin } from './plugins/composable-keys' @@ -93,7 +92,7 @@ export async function bundle (nuxt: Nuxt) { await nuxt.callHook('vite:extend', ctx) - nuxt.hook('vite:serverCreated', (server: vite.ViteDevServer, env) => { + nuxt.hook('vite:serverCreated', (server: vite.ViteDevServer) => { // Invalidate virtual modules when templates are re-generated ctx.nuxt.hook('app:templatesGenerated', () => { for (const [id, mod] of server.moduleGraph.idToModuleMap) { @@ -102,11 +101,6 @@ export async function bundle (nuxt: Nuxt) { } } }) - - const start = Date.now() - warmupViteServer(server, ['/entry.mjs']) - .then(() => logger.info(`Vite ${env.isClient ? 'client' : 'server'} warmed up in ${Date.now() - start}ms`)) - .catch(logger.error) }) await buildClient(ctx)