Skip to content

Commit

Permalink
Merge pull request #15542 from wangjinyang/bugfix/mf-hmr-error
Browse files Browse the repository at this point in the history
fix hrm error when works with Module federation
  • Loading branch information
sokra committed Apr 4, 2022
2 parents a9aa422 + ceed937 commit 2a58ce7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/container/RemoteRuntimeModule.js
Expand Up @@ -73,9 +73,9 @@ class RemoteRuntimeModule extends RuntimeModule {
Template.indent(
`error.message += '\\nwhile loading "' + data[1] + '" from ' + data[2];`
),
`__webpack_modules__[id] = ${runtimeTemplate.basicFunction("", [
"throw error;"
])}`,
`${
RuntimeGlobals.moduleFactories
}[id] = ${runtimeTemplate.basicFunction("", ["throw error;"])}`,
"data.p = 0;"
])};`,
`var handleFunction = ${runtimeTemplate.basicFunction(
Expand Down Expand Up @@ -111,10 +111,11 @@ class RemoteRuntimeModule extends RuntimeModule {
)};`,
`var onFactory = ${runtimeTemplate.basicFunction("factory", [
"data.p = 1;",
`__webpack_modules__[id] = ${runtimeTemplate.basicFunction(
"module",
["module.exports = factory();"]
)}`
`${
RuntimeGlobals.moduleFactories
}[id] = ${runtimeTemplate.basicFunction("module", [
"module.exports = factory();"
])}`
])};`,
"handleFunction(__webpack_require__, data[2], 0, 0, onExternal, 1);"
])});`
Expand Down

0 comments on commit 2a58ce7

Please sign in to comment.