Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

module federation load it's chunks from a wrong url #18407

Closed
joebnb opened this issue May 17, 2024 · 0 comments
Closed

module federation load it's chunks from a wrong url #18407

joebnb opened this issue May 17, 2024 · 0 comments

Comments

@joebnb
Copy link

joebnb commented May 17, 2024

Bug report

What is the current behavior?

remote app

when using module federation webpack will generate:

  • entry eg:static/remoteEntry.js
  • entry's dependenceies eg:static/remoteEntry_index.ad3ds.js

this remote app this app running in localhost:10000

 new ModuleFederationPlugin({
      name: 'remoteEntry',
      library: { type: 'window', name: 'remoteEntry' },
      filename: 'static/remoteEntry.js',
      exposes: {
        './entry': './src/remoteEntry',
      },
    }),

host app

configurate remoteEntry.js address eg:http://localhost:10000/static/remoteEntry.js in host app.

config like:

  new ModuleFederationPlugin({
      name: 'host',
      remotes: {
        remoteEntry:'portalRemote@http://localhost:10000/static/remoteEntry.js'
      },
    }),

visit host app http://localhost:10001 NOTIC:remote and host are different origin

chrome console will print remoteEntry's chunks will 404 beacause it's will load from http://localhost:10001/remoteEntry_index.ad3ds.js
request were use incorrect origin and lost pathname

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?

actually expect if i config host app like http://localhost:10000/static/remoteEntry.js,module federation plugin will load it's dependence from http://localhost:10000/static/ not http://localhost:10001,

if specified remote url, the remote artifacts should read from remote, host app may not have remote app files.

if this is not a bug, would give me some suggestion or explain how to workaround this


screenshots

image

image

@webpack webpack locked and limited conversation to collaborators May 22, 2024
@alexander-akait alexander-akait converted this issue into discussion #18422 May 22, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant