feat: allow to override the default react-refresh-loader #70
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