File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
examples/basic/src/routes/tailwind Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 1+ console . log ( 'unused file text-[#f12345]' )
Original file line number Diff line number Diff line change @@ -398,6 +398,16 @@ export default function vitePluginRsc(
398398
399399 if ( ! isInsideClientBoundary ( ctx . modules ) ) {
400400 if ( this . environment . name === 'rsc' ) {
401+ // detect if this module is only created as css deps (e.g. tailwind)
402+ // (NOTE: this is not necessary since Vite 7.1.0-beta.0 https://github.com/vitejs/vite/pull/20391 )
403+ if (
404+ ctx . modules
405+ . flatMap ( ( m ) => [ ...m . importers ] )
406+ . every ( ( m ) => m . id && isCSSRequest ( m . id ) )
407+ ) {
408+ return
409+ }
410+
401411 // transform js to surface syntax errors
402412 for ( const mod of ctx . modules ) {
403413 if ( mod . type === 'js' ) {
@@ -426,6 +436,7 @@ export default function vitePluginRsc(
426436 // Server files can be included in client module graph, for example,
427437 // when `addWatchFile` is used to track js files as style dependency (e.g. tailwind)
428438 // In this case, reload all importers (for css hmr), and return empty modules to avoid full-reload.
439+ // (NOTE: this is not necessary since Vite 7.1.0-beta.0 https://github.com/vitejs/vite/pull/20391 )
429440 const env = ctx . server . environments . rsc !
430441 const mod = env . moduleGraph . getModuleById ( ctx . file )
431442 if ( mod ) {
You can’t perform that action at this time.
0 commit comments