Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix hrm error when works with Module federation #15542

Merged
merged 7 commits into from
Apr 4, 2022
15 changes: 8 additions & 7 deletions lib/container/RemoteRuntimeModule.js
Original file line number Diff line number Diff line change
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