Skip to content

Fast refresh ​

TL;DR: Run rspfx dev --refresh to keep component state on save. Supported frameworks patch in place. Vanilla and failures fall back to reload.

Use rspfx dev for the most predict state, such as when you debug property panes. Use rspfx dev --refresh for fast UI iteration.

How it works ​

save -> incremental rebuild -> manifest regen -> websocket event -> browser update
  with --refresh: framework HMR patches the tree in place - state stays
  without: full page reload

Any HMR failure falls back to reload. The workbench never stays blank.

Framework support ​

FrameworkFast refreshMechanismOn save
Reactyesplugin-react-refreshstate stays, hooks replay
Preactyesplugin-preact-refreshstate stays
Vueyesvue-loader HMRtree patched
Svelteyessvelte-loader hotReloadinstance via $set
Solidyessolid-refreshsignals stay
Vanillanononereload

Enable with flag or config:

sh
rspfx dev --refresh

Or in bundler config set dev.fastRefresh: true.

See Choosing a framework.

rspfx dev vs rspfx dev --refresh ​

rspfx devrspfx dev --refresh
Save to updaterebuild then reloadrebuild then state patch where supported
Frameworks hitall reloadReact, Preact, Vue, Svelte, Solid keep state
Failurereloadreload

Comparison with official ​

AspectOfficial gulp serveRSPFx
Hot updatereload onlystate patch for five frameworks with --refresh
Vanillareloadreload
Failurereloadreload

Missing plugin - warning not break ​

Fast refresh plugins are build deps. If a plugin is not installed, RSPFx warns and reloads instead of failing:

[rspfx] fast-refresh plugin for react is not installed - HMR is disabled

Same for @rspack/plugin-preact-refresh, vue-loader, and solid-refresh. Install the peer to enable HMR. Check your terminal if you expect HMR but get reloads.

For flag details, see ../../reference/commands.md.

Released under the MIT License.