@@ -547,29 +547,39 @@ async function hmrWorkflow({
547547 ) ;
548548
549549 const testCases = [
550- { file : "styles-bundled.css" , selector : "#css-bundled" } ,
550+ {
551+ file : "styles-bundled.css" ,
552+ selector : "#css-bundled" ,
553+ } ,
551554 // TODO: Fix HMR for CSS Modules in server-first routes in RSC Framework mode
552555 ...( routeBase === "rsc-server-first-route"
553556 ? [ ]
554- : [ { file : "styles.module.css" , selector : "#css-modules" } ] ) ,
555- // TODO: Fix HMR for `?url` CSS imports in RSC Framework mode: https://github.com/vitejs/vite-plugin-react/issues/772
556- // Once fixed, check if this also fixes HMR for Vanilla Extract
557- ...( templateName . includes ( "rsc" )
558- ? [ ]
559- : [
560- {
561- file : "styles-postcss-linked.css" ,
562- selector : "#css-postcss-linked" ,
563- } ,
557+ : ( [
564558 {
565- file : "styles-vanilla-global.css.ts " ,
566- selector : "#css-vanilla-global " ,
559+ file : "styles.module.css " ,
560+ selector : "#css-modules " ,
567561 } ,
562+ ] as const ) ) ,
563+ {
564+ file : "styles-postcss-linked.css" ,
565+ selector : "#css-postcss-linked" ,
566+ } ,
567+ {
568+ file : "styles-vanilla-global.css.ts" ,
569+ selector : "#css-vanilla-global" ,
570+ } ,
571+ // TODO: Fix HMR for locally scoped Vanilla Extract styles in RSC
572+ // Framework mode. May require changes to the RSC plugin, or Vanilla
573+ // Extract. Userland workaround for now:
574+ // https://github.com/pawelblaszczyk5/vite-rsc-experiments/blob/643649f2e6562c859d9612126bfc3a183e03c7b5/apps/vanilla-extract/vite.config.ts
575+ ...( templateName . includes ( "rsc" )
576+ ? [ ]
577+ : ( [
568578 {
569579 file : "styles-vanilla-local.css.ts" ,
570580 selector : "#css-vanilla-local" ,
571581 } ,
572- ] ) ,
582+ ] as const ) ) ,
573583 ] as const satisfies Array < {
574584 file : string ;
575585 selector : string ;
@@ -584,8 +594,15 @@ async function hmrWorkflow({
584594 `CSS update for ${ routeFile } ` ,
585595 ) . toHaveCSS ( "padding" , NEW_PADDING ) ;
586596
587- // TODO: Fix state preservation when changing CSS Modules in RSC Framework mode
588- if ( templateName . includes ( "rsc" ) && file === "styles.module.css" ) {
597+ // TODO: Fix state preservation when changing these styles in RSC
598+ // Framework mode. This appears to be a deeper HMR issue with
599+ // changing non-React modules imported by the route.
600+ if (
601+ templateName . includes ( "rsc" ) &&
602+ ( file === "styles.module.css" ||
603+ file === "styles-postcss-linked.css" ||
604+ file === "styles-vanilla-global.css.ts" )
605+ ) {
589606 continue ;
590607 }
591608
0 commit comments