Replies: 1 comment 1 reply
-
You need to preload them too... Can you provide a small example of your problem using github and I will show you how to fix and why it happend |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I find host project will throw
ScriptExternalLoadError
error while loading remote module sometimes, if remote project usessplitChunkPlugin
orruntime: 'single'
to optimize.Surface
This part will explain why
ScriptExternalLoadError
would be thrown.In general,
remoteEntry.js
is anIIFE
in remote project's bundle artifacts, looks like:In host project, will use
__webpack_require.l
to load remote module. And at__webpack_require__.l
's callback, if module federation's global variable is nil, will throwScriptExternalLoadError
.However,
remoteEntry.js
is arrayfied if usingsplitChunkPlugin
orruntime: 'single'
, looks like:In this case, module federation's global variable is always nil, because assign expression is not executed after loading
remoteEntry.js
. It makes__webpack_require__.l
's callback always throwScriptExternalLoadError
.Hope to do
If it is actually a bug, I have a preliminary idea to fix it. If it is possible to keep module federation's entry file always be
IIFE
, instead of arrayfied sometimes.Beta Was this translation helpful? Give feedback.
All reactions