Open RexSkz opened 1 month ago
Either removeing optimization.runtimeChunk or using hard-coded remotes instead of dynamic remotes will solve the issue. But to fully solve it, we should pass ...args instead of arg in init.
What do you mean?
In the chapter Promise Based Dynamic Remotes:
But init
actually has more than one parameter. If we don't pass all the parameters, the whole app will show a white screen. (You can follow the "steps to reproduce" to see.)
I solved this issue by changing the code like this:
- init: (arg) => {
+ init: (...args) => {
try {
- return window.app1.init(arg)
+ return window.app1.init(...args)
} catch(e) {
console.log('remote container already initialized')
}
}
Bug report
What is the current behavior?
If I set
optimization.runtimeChunk
and use dynamic remotes, the app will show a blank screen with no error.If the current behavior is a bug, please provide the steps to reproduce.
pnpm i && pnpm start
(it's a monorepo which uses pnpm workspace feature)There is more information (also with my investigation) in this repo.
What is the expected behavior?
You will get a console trace (with the number
42
) immediately after the page is loaded.Either removeing
optimization.runtimeChunk
or using hard-coded remotes instead of dynamic remotes will solve the issue. But to fully solve it, we should pass...args
instead ofarg
ininit
.I'm not sure whether it's a documentation issue or some sort of design, please correct me if anything wrong :)
Other relevant information: webpack version:
5.91.0
Node.js version:18.19.0
Operating System:Windows 11
Additional tools: none