Skip to content
Open
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
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,12 +626,21 @@ export default function solidPlugin(options: Partial<Options> = {}): Plugin[] {
} as typeof hot.send;
},

hotUpdate() {
hotUpdate({ modules }) {
// solid-refresh only injects HMR boundaries into client modules, so
// non-client environments have no accept handlers. Without this, Vite
// would see no boundaries and send full-reload messages that race with
// client-side HMR updates.
if (this.environment.name !== 'client') {
// Returning [] also suppresses the signal environment-runner based
// servers (e.g. nitro's dev worker) rely on to re-evaluate modules,
// leaving SSR stale until a manual restart. Send the reload on this
// environment's own channel — for runner-based environments that is
// the runner, for the default ssr environment a no-op, and never the
// browser websocket, so client HMR stays free of full-reload races.
if (modules.length > 0) {
this.environment.hot.send({ type: 'full-reload' });
}
return [];
}
},
Expand Down
Loading