feat: allow to override the default react-refresh-loader#70
Merged
chenjiahan merged 1 commit intorstackjs:mainfrom Jan 7, 2026
Merged
Conversation
Thank you for working on the React implementation for Rspack, we are excited to use it in our company stack. Yet, we have faced a challenge regarding the React Fast Refresh instrumentation. The problem is that, along with React jsx, we use a custom in-house rendering runtime with `/** @jsxImportSource custom-jsx */` pragma. Unfortunately, while Fast Refresh does work for the React components, for such custom runtime components the HMR is completely broken. As a workaround, engineers disable RFR and fall back to HMR. I want to improve the experience for the product teams and found out that I can write my own react-refresh loader, which is 99% the same as `builtin:react-refresh-loader` but can handle the case with a custom jsx runtime. This seems to work just fine. And now we are missing a way to override the default builtin:react-refresh-loader. Hence, this PR adds a plugin option that allows specifying a custom react-refresh loader for those who want to have a more advanced RFR implementation
a8dccf5 to
4d29fd6
Compare
n0th1ng-else
commented
Jan 7, 2026
chenjiahan
approved these changes
Jan 7, 2026
Member
chenjiahan
left a comment
There was a problem hiding this comment.
Thanks for the PR. Really appreciate the contribution 🙌
Contributor
Author
|
Thanks a lot! This is great 🎉 |
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.
Thank you for working on the React implementation for Rspack, we are excited to use it in our company stack. Yet, we have faced a challenge regarding the React Fast Refresh instrumentation.
The problem is that, along with React jsx, we use a custom in-house rendering runtime with
/** @jsxImportSource custom-jsx */pragma.Unfortunately, while Fast Refresh does work for the React components, for such custom runtime components the HMR is completely broken. As a workaround, engineers disable RFR and fall back to HMR. I want to improve the experience for the product teams and found out that I can write my own react-refresh loader, which is 99% the same as
builtin:react-refresh-loaderbut can handle the case with a custom jsx runtime.This seems to work just fine. And now we are missing a way to override the default builtin:react-refresh-loader.
Hence, this PR adds a plugin option that allows specifying a custom react-refresh loader for those who want to have a more advanced RFR implementation