File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @vanilla-extract/vite-plugin ' : patch
3
+ ---
4
+
5
+ Fix stale emitted CSS in SSR mode by invalidating all modules related to a file
Original file line number Diff line number Diff line change @@ -216,16 +216,18 @@ export function vanillaExtractPlugin({
216
216
cssMap . get ( absoluteId ) !== source
217
217
) {
218
218
const { moduleGraph } = server ;
219
- const [ module ] = Array . from (
219
+ const modules = Array . from (
220
220
moduleGraph . getModulesByFile ( absoluteId ) || [ ] ,
221
221
) ;
222
222
223
- if ( module ) {
224
- moduleGraph . invalidateModule ( module ) ;
223
+ for ( const module of modules ) {
224
+ if ( module ) {
225
+ moduleGraph . invalidateModule ( module ) ;
225
226
226
- // Vite uses this timestamp to add `?t=` query string automatically for HMR.
227
- module . lastHMRTimestamp =
228
- ( module as any ) . lastInvalidationTimestamp || Date . now ( ) ;
227
+ // Vite uses this timestamp to add `?t=` query string automatically for HMR.
228
+ module . lastHMRTimestamp =
229
+ ( module as any ) . lastInvalidationTimestamp || Date . now ( ) ;
230
+ }
229
231
}
230
232
231
233
server . ws . send ( {
You can’t perform that action at this time.
0 commit comments