originjs / vite-plugin-federation

Module Federation for vite & rollup
Other
2.29k stars 236 forks source link

【example demo bug】Did not work as expected when using the sample demo #578

Open zhaoky opened 7 months ago

zhaoky commented 7 months ago

Steps to reproduce

  1. Pull the code from the main branch and install the dependency.
  2. Run the vue3-demo-esm example.
  3. The project started successfully, but some components did not load as expected.
image

Components in the red box are not rendered

What is Expected?

All components render normally.

What is actually happening?

Some components are not rendered.

image

Whether the remote component's module is asynchronously fetched, causing the ‘default‘ to be undefined?

Issues-translate-bot commented 4 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


It's because of shards. Button and Content use pinia. Requesting pinai is a promise, and the first accessed component defalut will be undefind.

xplloveyxl commented 4 months ago

It's because of shards. Button and Content use pinia. Requesting pinai is a promise, and the first accessed component defalut will be undefind.

xplloveyxl commented 4 months ago

const dynamicComponents = ['Button','Images','Content'];

If the Content is placed after the Button, the Button will be undefined. Although I have found the problem, I still don't know how to configure it. I am still researching. Have you taken care of it?