@@ -2102,9 +2102,10 @@ function vitePluginRscCss(
2102
2102
const importer = parsed . id
2103
2103
if ( this . environment . mode === 'dev' ) {
2104
2104
const result = collectCss ( server . environments . rsc ! , importer )
2105
- for ( const file of [ importer , ...result . visitedFiles ] ) {
2106
- this . addWatchFile ( file )
2107
- }
2105
+ // for (const file of [importer, ...result.visitedFiles]) {
2106
+ // this.addWatchFile(file)
2107
+ // }
2108
+ this . addWatchFile ( importer )
2108
2109
const cssHrefs = result . hrefs . map ( ( href ) => href . slice ( 1 ) )
2109
2110
const deps = assetsURLOfDeps ( { css : cssHrefs , js : [ ] } , manager )
2110
2111
return generateResourcesCode (
@@ -2126,6 +2127,18 @@ function vitePluginRscCss(
2126
2127
}
2127
2128
}
2128
2129
} ,
2130
+ configureServer ( server ) {
2131
+ // opt-out of soft invalidation of virtual modules to ensure re-executing `load`
2132
+ const moduleGraph = server . environments . rsc ! . moduleGraph
2133
+ const original = moduleGraph . invalidateModule
2134
+ moduleGraph . invalidateModule = function ( ...args ) {
2135
+ if ( args [ 0 ] . id && parseCssVirtual ( args [ 0 ] . id ) ) {
2136
+ // @ts -ignore
2137
+ args [ 4 ] = false
2138
+ }
2139
+ return original . apply ( this , args )
2140
+ }
2141
+ } ,
2129
2142
} ,
2130
2143
createVirtualPlugin (
2131
2144
'vite-rsc/remove-duplicate-server-css' ,
0 commit comments