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

【vue3-demo】Exporting a component with the same path and name as the host application replaces the host application component when the remote component is used. #4255

Open
lemontree2000 opened this issue Aug 20, 2024 · 1 comment

Comments

@lemontree2000
Copy link

lemontree2000 commented Aug 20, 2024

Description

I'm using the vue3-demo with the ,Exporting a component with the same path and name as the host application will overwrite the host application component when the remote component is used.

issues

provider directory

image
image

provider config

    new ModuleFederationPlugin({
      name: 'home',
      filename: 'remoteEntry.js',
      remotes: {
        home: 'home@http://localhost:3002/remoteEntry.js',
      },
      exposes: {
        './Content': './src/components/Content',
        './Button': './src/components/Button',
        './Layout': './src/components/Layout',
        './Self': './src/Self',
      },
      shared: {
        vue: {
          singleton: true,
        },
      },
    }),

consumer directory

image
image

consumer config

    new ModuleFederationPlugin({
      name: 'layout',
      filename: 'remoteEntry.js',
      remotes: {
        home: 'home@http://localhost:3002/remoteEntry.js',
      },
      exposes: {},
      shared: {
        vue: {
          singleton: true,
        },
      },
    }),

use remote component

image

Expect

It is expected that there should be two lines of text each:
Self component.
Self component from remote;

Practice

The actual two lines of text both show: Self component from remote; It looks like the remote component overrides the local component
image

Reproducible code

https://github.com/lemontree2000/module-federation-vue3-demo

@lemontree2000
Copy link
Author

There seems to be no problem after the file name and path are changed

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