When trying to use the @rspack/plugin-react-refresh module, importing the ReactRefreshRspackPlugin class via import { ReactRefreshRspackPlugin } from "@rspack/plugin-react-refresh"; results in an undefined error.
Expected Behavior:
The ReactRefreshRspackPlugin class should be correctly imported from the module, with the correct usage being:
import ReactRefreshRspackPlugin from "@rspack/plugin-react-refresh";
Actual Behavior:
Using import { ReactRefreshRspackPlugin } from "@rspack/plugin-react-refresh"; returns undefined, causing errors when trying to use new RefreshPlugin().
Workaround Solution:
import * as RefreshPluginModule from "@rspack/plugin-react-refresh";
// Get the actual class from the module
const ReactRefreshRspackPlugin = RefreshPluginModule.ReactRefreshRspackPlugin || RefreshPluginModule.default || RefreshPluginModule;
plugins: [
new ReactRefreshRspackPlugin()
]
Rspack Version: 1.3.8
Rspack-Plugin-React-Refresh Version: 1.4.1