Skip to content

Commit c3c2023

Browse files
authored
fix: fallback to constructor.name when constructorName is not available (#42)
1 parent e563d64 commit c3c2023

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,9 @@ class PreactRefreshRspackPlugin implements RspackPluginInstance {
121121
compiler.hooks.thisCompilation.tap(NAME, (compilation) => {
122122
compilation.hooks.runtimeModule.tap(NAME, (runtimeModule) => {
123123
// rspack does not have addRuntimeModule and runtimeRequirements on js side
124+
const name = runtimeModule.constructorName || runtimeModule.constructor?.name;
124125
if (
125-
runtimeModule.constructorName === 'HotModuleReplacementRuntimeModule'
126+
name === 'HotModuleReplacementRuntimeModule'
126127
) {
127128
if (!runtimeModule.source) {
128129
throw new Error(

0 commit comments

Comments
 (0)