Add support for web-components
See original GitHub issueHello @antfu,
unfortunately I can not use vue-demi
in a micro frontend setup, where the container SPA provides the vue instance via window.Vue
. The web components are using vue-demi
but they crash since it tries to install the composition api on a non existing Vue instance.
[vue-composition-api] No vue dependency found. (in getRegisteredVueOrDefault)
is there any workaround to make this default install(Vue)
call optional?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
"web components" | Can I use... Support tables for ... - CanIUse
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >Web Components - MDN Web Docs - Mozilla
Web Components is a suite of different technologies allowing you to create ... Add child elements, event listeners, etc., to the shadow DOM ......
Read more >Custom Elements Everywhere
Custom Elements are the lynchpin in the Web Components specifications. They give developers the ability to ... feat: Add native support for custom...
Read more >A Complete Introduction to Web Components in 2022 - Kinsta
Web Components are a standard way to create reusable and modular HTML elements without using a JavaScript framework.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Unfortunately my time is currently very limited, so I decided to add the solution here instead of creating an example project.
Things that have to be done in the container-ui project (the host Vue SPA for the web components):
Things that have to be done in the web-component project:
First move
vue
,@vue/composition-api
andvue-demi
to the devDependencies.Also make sure all composition api related imports are imported from
vue-demi
in both projects.This should prevent having multiple instances of the composition api in a micro-frontend setup with web-components
Found and fixed the issue. I will create an example project on GitHub the next days and share the link here 😉