Skip to content
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

The module federation file is not loaded #4244

Open
ceechen0 opened this issue Jul 18, 2024 · 0 comments
Open

The module federation file is not loaded #4244

ceechen0 opened this issue Jul 18, 2024 · 0 comments

Comments

@ceechen0
Copy link

ceechen0 commented Jul 18, 2024

Configuration of A

new ModuleFederationPlugin({
          name: 'jxjy',
          filename: 'remote.js',
          exposes: {
            './info': './src/unit-share/network-school/basic-data/info/index.vue'
          },
          remotes: {
            jxjy_remote: 'jxjy_remote@http://192.168.10.56:8080/jxjy_remote.js'
          },
          library: {
            type: 'window',
            name: 'jxjy'
          },
          shared: {
            vue: {
              singleton: true,
              version: '2.6.11'
            },
            '@hbfe-api/biz-information-management': {
              singleton: true
            },
            axios: {
              singleton: true,
              version: '0.19.2'
            }
          }
        })

Configuration of B

new ModuleFederationPlugin({
  name: 'jxjy_remote',
  filename: 'jxjy_remote.js',
  exposes: {
    './role': './src/unit-share/network-school/basic-data/account/role/index.vue'
  },
  library: {
    type: 'window',
    name: 'jxjy_remote'
  },
  remotes: {
    jxjy: 'jxjy@http://localhost:8081/remote.js'
  },
  shared: {
    vue: {
      singleton: true,
      version: '2.6.11'
    },
    '@hbfe-api/biz-information-management': {
      singleton: true
    },
    axios: {
      singleton: true,
      version: '0.19.2'
    }
  }
})

Project Information

Both projects were built using vue/cli. The publicPath has been set to auto and the uniqueName in output has been configured separately. Module federation can be used normally if only one party provides the component and one party uses the component.

The console does not prompt any errors, only a warning that the dependent version in shared does not match.

questions

The two projects are configured according to the documents. According to the principle, A project can be both A provider and a consumer. However, after such configuration, I did not find the files of project A requesting project B in the network request, nor did Project A requesting project B in the B project. Why is that? Is there a problem with my configuration?
Moreover, in the network request, it can be seen that the MF file obtained by A project is provided by A project itself, and the B project is also like this.

This is A network request from Project A, and this remote.js is supposed to be what it's going to provide, but now it loads itself
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant