core icon indicating copy to clipboard operation
core copied to clipboard

@module-federation v2 runtime plugin - remoteEntry import

Open Keitar6 opened this issue 1 year ago • 5 comments

Describe the bug

When trying to import with the remote there is some weird thing going on as screenshot below shows: image

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

Keitar6 avatar Jun 03 '24 11:06 Keitar6

Hmmm 🤔 do you have any custom publicPath set? What if you set it to auto?

ScriptedAlchemy avatar Jun 03 '24 11:06 ScriptedAlchemy

Nope, just regular localhost:3000 communicating with localhost:3001. Unfortunately, it did not help :/

Keitar6 avatar Jun 03 '24 11:06 Keitar6

Is this only when using json remotes?

ScriptedAlchemy avatar Jun 03 '24 12:06 ScriptedAlchemy

@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:

image

Keitar6 avatar Jun 04 '24 12:06 Keitar6

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.

ScriptedAlchemy avatar Jun 06 '24 21:06 ScriptedAlchemy

Stale issue message

github-actions[bot] avatar Aug 06 '24 15:08 github-actions[bot]