diff --git a/packages/vite/src/utils/warmup.ts b/packages/vite/src/utils/warmup.ts index fe359c1ae9..a16d2f6d9d 100644 --- a/packages/vite/src/utils/warmup.ts +++ b/packages/vite/src/utils/warmup.ts @@ -1,4 +1,4 @@ -import { isBuiltin } from 'node:module' +import { builtinModules } from 'node:module' import { logger } from '@nuxt/kit' import { join, normalize, relative } from 'pathe' import { withoutBase } from 'ufo' @@ -28,6 +28,12 @@ function normaliseURL (url: string, base: string) { return url } +// TODO: remove when we drop support for node 18 +const builtins = new Set(builtinModules) +function isBuiltin (id: string) { + return id.startsWith('node:') || builtins.has(id) +} + // TODO: use built-in warmup logic when we update to vite 5 export async function warmupViteServer ( server: ViteDevServer,