From 9bb779d2f9c60de29954f4912a2aa229fcd2be2e Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Fri, 12 Jan 2024 11:19:08 +0800 Subject: [PATCH] Disable file watcher for internal one-off vite servers (#9665) --- .changeset/blue-pets-battle.md | 5 +++++ packages/astro/src/core/config/vite-load.ts | 2 +- packages/astro/src/core/sync/index.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/blue-pets-battle.md diff --git a/.changeset/blue-pets-battle.md b/.changeset/blue-pets-battle.md new file mode 100644 index 000000000000..1752627435dc --- /dev/null +++ b/.changeset/blue-pets-battle.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Disables internal file watcher for one-off Vite servers to improve start-up performance diff --git a/packages/astro/src/core/config/vite-load.ts b/packages/astro/src/core/config/vite-load.ts index 8ef15d9a2074..8939c2a8f9a4 100644 --- a/packages/astro/src/core/config/vite-load.ts +++ b/packages/astro/src/core/config/vite-load.ts @@ -6,7 +6,7 @@ import { debug } from '../logger/core.js'; async function createViteServer(root: string, fs: typeof fsType): Promise { const viteServer = await createServer({ - server: { middlewareMode: true, hmr: false, watch: { ignored: ['**'] } }, + server: { middlewareMode: true, hmr: false, watch: null }, optimizeDeps: { disabled: true }, clearScreen: false, appType: 'custom', diff --git a/packages/astro/src/core/sync/index.ts b/packages/astro/src/core/sync/index.ts index bfaed6c2f9fd..395f431771e4 100644 --- a/packages/astro/src/core/sync/index.ts +++ b/packages/astro/src/core/sync/index.ts @@ -81,7 +81,7 @@ export async function syncInternal( const tempViteServer = await createServer( await createVite( { - server: { middlewareMode: true, hmr: false, watch: { ignored: ['**'] } }, + server: { middlewareMode: true, hmr: false, watch: null }, optimizeDeps: { disabled: true }, ssr: { external: [] }, logLevel: 'silent',