Merge pull request #15542 from wangjinyang/bugfix/mf-hmr-error

fix hrm error when works with Module federation
This commit is contained in:
Tobias Koppers 2022-04-04 11:25:46 +02:00 committed by GitHub
commit 2a58ce7883
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -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(
@ -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);"
])});`