core
core copied to clipboard
Cannot use vue2.7 lifecycle hook through module federation
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().
Reproduction
https://github.com/Cybbin/pj-module-federation
Used Package Manager
npm
System Info
vue2.7
Validations
- [X] Read the docs.
- [X] Read the common issues list.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Module federation issue and not a framework-specific issue.
- [X] The provided reproduction is a minimal reproducible example of the bug.