core icon indicating copy to clipboard operation
core copied to clipboard

Cannot use vue2.7 lifecycle hook through module federation

Open Cybbin opened this issue 1 year ago • 2 comments

Describe the bug

I have two applications built on Vue 2.7. When I try to share app1's component through module federation with app2, I find that I can't use such as "onMounted" composition api hook.

vue.runtime.esm.js:4448 [Vue warn]: onMounted is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().

image

Reproduction

https://github.com/Cybbin/pj-module-federation

Used Package Manager

npm

System Info

vue2.7

Validations

Cybbin avatar Jul 04 '24 10:07 Cybbin