Skip to content

Conversation

@n0th1ng-else
Copy link
Contributor

@n0th1ng-else n0th1ng-else commented Jan 7, 2026

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

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
@n0th1ng-else n0th1ng-else force-pushed the custom-react-refresh-loader branch from a8dccf5 to 4d29fd6 Compare January 7, 2026 10:05
@n0th1ng-else n0th1ng-else changed the title feat: Allow to override the default react-refresh-loader feat: allow to override the default react-refresh-loader Jan 7, 2026
@n0th1ng-else n0th1ng-else marked this pull request as ready for review January 7, 2026 10:05
Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Really appreciate the contribution 🙌

@chenjiahan chenjiahan merged commit 50043af into rstackjs:main Jan 7, 2026
1 check passed
@chenjiahan
Copy link
Member

released: https://github.com/rstackjs/rspack-plugin-react-refresh/releases/tag/v1.6.0

@n0th1ng-else
Copy link
Contributor Author

Thanks a lot! This is great 🎉

@n0th1ng-else n0th1ng-else deleted the custom-react-refresh-loader branch January 7, 2026 12:44
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