Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/plugin-rsc/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ export default function vitePluginRsc(
}
},
async hotUpdate(ctx) {
if (isCSSRequest(ctx.file)) {
if (ctx.modules.every((m) => m.type === 'css')) {
if (this.environment.name === 'client') {
// filter out `.css?direct` (injected by SSR) to avoid browser full reload
// when changing non-self accepting css such as `module.css`.
Expand Down Expand Up @@ -421,7 +421,7 @@ export default function vitePluginRsc(
if (mod) {
for (const clientMod of ctx.modules) {
for (const importer of clientMod.importers) {
if (importer.id && isCSSRequest(importer.id)) {
if (importer.id && importer.type === 'css') {
await this.environment.reloadModule(importer)
}
}
Expand Down Expand Up @@ -1621,7 +1621,7 @@ export function vitePluginRscCss(
}
for (const next of mod?.importedModules ?? []) {
if (next.id) {
if (isCSSRequest(next.id)) {
if (next.type === 'css') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like css is actually type: 'js' 🤔

EnvironmentModuleNode {
  environment: 'rsc',
  url: '/src/index.css',
  id: '/home/hiroshi/code/others/vite-plugin-react/packages/plugin-rsc/examples/starter/src/index.css',
  file: '/home/hiroshi/code/others/vite-plugin-react/packages/plugin-rsc/examples/starter/src/index.css',
  type: 'js',
  info: undefined,
  meta: undefined,
  importers: Set(1) {
    EnvironmentModuleNode {
      environment: 'rsc',
      url: '/src/root.tsx',
      id: '/home/hiroshi/code/others/vite-plugin-react/packages/plugin-rsc/examples/starter/src/root.tsx',
      file: '/home/hiroshi/code/others/vite-plugin-react/packages/plugin-rsc/examples/starter/src/root.tsx',
      type: 'js',

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cssIds.add(next.id)
} else {
recurse(next.id)
Expand Down
Loading