Skip to content

Commit 6eaec3a

Browse files
committed
fix(hmr/css): check CSS importers for hmr boundaries - fix Tailwind 2.2 compat
1 parent 385ced9 commit 6eaec3a

File tree

1 file changed

+15
-0
lines changed
  • packages/vite/src/node/server

1 file changed

+15
-0
lines changed

packages/vite/src/node/server/hmr.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { RollupError } from 'rollup'
1010
import { prepareError } from './middlewares/error'
1111
import match from 'minimatch'
1212
import { Server } from 'http'
13+
import { isCSSRequest } from '../plugins/css'
1314

1415
export const debugHmr = createDebugger('vite:hmr')
1516

@@ -222,6 +223,20 @@ function propagateUpdate(
222223
boundary: node,
223224
acceptedVia: node
224225
})
226+
227+
// additionally check for CSS importers, since a PostCSS plugin like
228+
// Tailwind JIT may register any file as a dependency to a CSS file.
229+
for (const importer of node.importers) {
230+
if (isCSSRequest(importer.url)) {
231+
propagateUpdate(
232+
importer,
233+
timestamp,
234+
boundaries,
235+
currentChain.concat(importer)
236+
)
237+
}
238+
}
239+
225240
return false
226241
}
227242

0 commit comments

Comments
 (0)