You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: allow to override the default react-refresh-loader
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
Copy file name to clipboardExpand all lines: README.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -227,6 +227,21 @@ new ReactRefreshPlugin({
227
227
});
228
228
```
229
229
230
+
### reactRefreshLoader
231
+
232
+
- Type: `string`
233
+
- Default: `builtin:react-refresh-loader`
234
+
235
+
Be default, the plugin uses `builtin:react-refresh-loader` loader implementation [from Rspack](https://github.com/web-infra-dev/rspack/tree/main/crates/rspack_loader_react_refresh) in order ot inject
236
+
the React Refresh utilities into each module. `reactRefreshLoader` option allows to specify the loader, that implements
Thanks to the [react-refresh-webpack-plugin](https://github.com/pmmmwh/react-refresh-webpack-plugin) created by [@pmmmwh](https://github.com/pmmmwh), which inspires implement this plugin.
0 commit comments