Skip to content

Commit

Permalink
fix: fix client hmr
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Aug 31, 2024
1 parent 34dc486 commit 0069ba5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/react-server/src/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,10 @@ export function vitePluginReactServer(
// In this case, reload all importers (for css hmr),
// and return empty modules to avoid full-reload
const importers = ctx.modules.flatMap((m) => [...m.importers]);
if (importers.every((m) => m.id && isCSSRequest(m.id))) {
if (
importers.length > 0 &&
importers.every((m) => m.id && isCSSRequest(m.id))
) {
for (const m of importers) {
await $__global.dev.server.reloadEnvironmentModule(m);
}
Expand Down

0 comments on commit 0069ba5

Please sign in to comment.