File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
examples/basic/src/routes/style-server Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,6 @@ export function TestStyleServer() {
2828 )
2929}
3030
31- // add no-op `import.meta.hot` to trigger `prune` event
32- // https://github.com/vitejs/vite/blob/84079a84ad94de4c1ef4f1bdb2ab448ff2c01196/packages/vite/src/node/plugins/importAnalysis.ts#L829-L840
31+ // add no-op `import.meta.hot` to trigger `prune` event.
32+ // this is needed until we land https://github.com/vitejs/vite/pull/20768
3333import . meta. hot
Original file line number Diff line number Diff line change @@ -1026,6 +1026,11 @@ import.meta.hot.on("rsc:update", () => {
10261026 document.querySelectorAll("vite-error-overlay").forEach((n) => n.close())
10271027});
10281028`
1029+ // remove stylesheet links when css import is removed on rsc envrionment
1030+ const onRscPrune = ( e : vite . PrunePayload ) => {
1031+ console . log ( '[rsc:prune]' , e )
1032+ }
1033+ code += `import.meta.hot.on("rsc:prune", ${ onRscPrune } );`
10291034 return code
10301035 } ,
10311036 ) ,
@@ -2036,7 +2041,11 @@ function vitePluginRscCss(
20362041 hot . send = function ( this , ...args : any [ ] ) {
20372042 const e = args [ 0 ] as vite . PrunePayload
20382043 if ( e && typeof e === 'object' && e . type === 'prune' ) {
2039- console . log ( '[rsc:prune]' , e )
2044+ server . environments . client . hot . send ( {
2045+ type : 'custom' ,
2046+ event : 'rsc:prune' ,
2047+ data : e ,
2048+ } )
20402049 }
20412050 return original . apply ( this , args as any )
20422051 }
You can’t perform that action at this time.
0 commit comments