-
Notifications
You must be signed in to change notification settings - Fork 208
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
TypeError: Failed to fetch dynamically imported module: remoteEntry.js #766
Comments
Can you please provide a minimal reproduction via github? |
@manfredsteyer Thanks for the response. Unfortunately replicating the structure of the project would be a bit of work. I will try and come up with something or refine my question further.
and in the dynamic.federation.ts Cannot read properties of undefined (reading 'init') during container.init |
@manfredsteyer |
In the end the issue got resolved after removing shareall and only sharing a few deps |
For which library do you need help?
module-federation
Question
Hello
I am in middle of upgrading angular version from 12 to 15 for a dynamically module federated project.
As part of that I was also trying to upgrade the angular architects module federation plugin from v12 to v15 when I encounter this error. I have tried a bunch of permutations with the webpack config but I keep running into different errors. Any help or insight on this would be much appreciated.
Before the fetch module error the console also prints the following error in line 1 of the remoteEntry.js:
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "application/json". Strict MIME type checking is enforced for module scripts per HTML spec. remoteEntryjs.1
In my shell I am directly using loadRemoteModule function to load the remote modules dynamically.
For the shell and mfe I have set the module, target, lib as es2022 in tsconfig.
As given in the readme for the repo I have defined the webpack config for the shell and mfe accordingly(attached below).
I have a guard which gets activated via the shell and loads the remote mfes in turn via routing. The code for the same is attached here. In the code pluginsConfig is populated in the mfe via a javascript and the information is fetched via a service inside the guard in another function.
The error for failing to fetch remote module happens inside this loadRemoteModule function.
Shell webpack.config.js:
MFE webpack.config.js:
Shared map of dependencies looks like below:
I also tried to work with shareAll for sharing dependencies but ran into the #253 error. Any help or insight on this would be much appreciated. Thanks in advance.
The text was updated successfully, but these errors were encountered: