diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index 8ca2e5e732ae94..00fa0ac349874b 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -503,7 +503,7 @@ export async function createServer( // run post config hooks // This is applied before the html middleware so that user middleware can // serve custom content instead of index.html. - postHooks.forEach((fn) => fn && fn()) + postHooks.forEach((fn) => fn?.()) if (!middlewareMode || middlewareMode === 'html') { // spa fallback