Add HMR and React Fast Refresh support#109
Merged
SchrodingersGat merged 4 commits intoJun 5, 2026
Merged
Conversation
The URL is now passed to the callback, which then checks that the same file is being loaded before replacing the module.
SchrodingersGat
approved these changes
Jun 2, 2026
SchrodingersGat
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Together with the InvenTree PR (inventree/InvenTree#12060), this enables HMR to work correctly, including react fast refresh.
The
inventreeHmrPluginVite 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?