@module-federation v2 runtime plugin - remoteEntry import
Describe the bug
When trying to import with the remote there is some weird thing going on as screenshot below shows:
there shoud be '/static/chunks' there but for some reason it gets doubled and ofcourse i get an error because there is not the correct url. The funny thing is that 'mf-manifest.json' is being downloaded correctly.
The cause of it is definietly the preloadRemote function that i use in app.tsx but i am not sure why exactly. I could not track this url in the runtimePlugin or middleware.
There is no error like that when i put it in getServerSideProps in app.tsx. Like below:
export async function getServerSideProps() {
try {
await preloadRemote([
{
nameOrAlias: 'remote1',
exposes: ['SomeTextFromRemote1'],
resourceCategory: 'all',
},
]);
} catch (error) {}
return { props: {} };
}
Reproduction
https://github.com/Keitar6/reproMF-chunks
Used Package Manager
npm
System Info
-
Validations
- [X] Read the docs.
- [X] Read the common issues list.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Module federation issue and not a framework-specific issue.
- [X] The provided reproduction is a minimal reproducible example of the bug.
Hmmm 🤔 do you have any custom publicPath set? What if you set it to auto?
Nope, just regular localhost:3000 communicating with localhost:3001. Unfortunately, it did not help :/
Is this only when using json remotes?
@ScriptedAlchemy From what i can see, when you try to preload or just just mf-manifest, event without preloading feature, it is adding filename, when downloading remoteEntry so in my case it is like that:
remote1 filename = static/chunks/remoteEntry.js, mf-manifest url = static/chunks/mf-manifest
when using mf-manifest it seems that url for remoteEntry is something like that: **/static/chunks/${filename}
Update: I can fix that with explicitly defining the publicPath but then i get an error like that:
Ahh okay. Next currently doesn't support manifest protocol from its remotes if they are also next. I'll look at how to resolve this but next hardly works to begin with.
Stale issue message