-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Description
Describe the bug
I have a vuejs 3 application (main-app) which is consuming a component from a lib project (micro-app) hosted on a remote location. I have defined a plugin as part of lib project which registers its components with vuejs 3 host application. While consuming components from lib project in the host application I am facing following issues -
- Remote component (
App1Home.vue) renders fine if it is having only one root component. But if I add more than one root component, it stops rendering without showing any error in the console logs or anywhere else. - Remote component (
App1Home.vue) has aonMounted()hook defined but same is not being triggered.
Host application - https://github.com/koyadume/main-app
Remote lib project - https://github.com/koyadume/micro-app
I had this working successfully with webpack 4 and so it seems this is an issue with vite.
Reproduction
https://github.com/koyadume/main-app
Steps to reproduce
- Clone following repos -
https://github.com/koyadume/main-app
https://github.com/koyadume/micro-app
- Execute following commands from the root folders of both the repos -
yarn install
yarn build
yarn preview
-
Above command will run host application (
main-app) on 8090 port while lib project (micro-app) will run on 8091 port. Lib project will be accessible over 8090 port through the proxy defined in host application. -
Open a browser and access
http://localhost:8090url. -
On the home page you will see
Micro Appprinted in the last line but it should ideally beMicro App (updated)ifonMounted()hook was fired successfully. -
Uncomment below line in
App1Home.vueofmicro-appproject and you will see that no content fromApp1Home.vuewill be printed on the home page.
<!-- <p>I'm a micro app which contains remote components.</p> -->
System Info
System:
OS: Windows 10 10.0.19044
CPU: (8) x64 Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
Memory: 2.74 GB / 15.61 GB
Binaries:
Node: 18.14.2 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.18 - ~\AppData\Roaming\npm\yarn.CMD
npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (110.0.1587.63)
Internet Explorer: 11.0.19041.1566Used Package Manager
yarn
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.