Skip to content

Add HMR and React Fast Refresh support#109

Merged
SchrodingersGat merged 4 commits into
inventree:mainfrom
xhivo97:enable-hmr-and-react-fast-refresh
Jun 5, 2026
Merged

Add HMR and React Fast Refresh support#109
SchrodingersGat merged 4 commits into
inventree:mainfrom
xhivo97:enable-hmr-and-react-fast-refresh

Conversation

@xhivo97
Copy link
Copy Markdown
Contributor

@xhivo97 xhivo97 commented Jun 1, 2026

Together with the InvenTree PR (inventree/InvenTree#12060), this enables HMR to work correctly, including react fast refresh.

The inventreeHmrPlugin Vite plugin is only needed for legacy plugins to be reloaded via Vite's HMR API. This may need a guard so that it only replaces a module if the names match, maybe the callback would be a good place for it.

For Fast Refresh to work, exported functions must be React components, so the hack of making the plugin entry exports start with a capital letter may not be ideal. Is there a reason not to export proper React components instead?

xhivo97 and others added 2 commits June 1, 2026 17:46
The URL is now passed to the callback, which then checks that the same
file is being loaded before replacing the module.
@SchrodingersGat SchrodingersGat merged commit ac3f5ae into inventree:main Jun 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants