From 5f2cdec5d61b847352b3412725fcc957dca010d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Mon, 4 Dec 2023 17:52:57 +0900 Subject: [PATCH] fix(hmr): don't consider CSS dep as a circular dep (#15229) --- packages/vite/src/node/server/hmr.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/vite/src/node/server/hmr.ts b/packages/vite/src/node/server/hmr.ts index 45ba8d5344081f..7f1620ee4f8070 100644 --- a/packages/vite/src/node/server/hmr.ts +++ b/packages/vite/src/node/server/hmr.ts @@ -394,6 +394,11 @@ function isNodeWithinCircularImports( // Node may import itself which is safe if (importer === node) continue + // a PostCSS plugin like Tailwind JIT may register + // any file as a dependency to a CSS file. + // But in that case, the actual dependency chain is separate. + if (isCSSRequest(importer.url)) continue + // Check circular imports const importerIndex = nodeChain.indexOf(importer) if (importerIndex > -1) {