Multiple Vue instances initialised
Environment
environment of the reproduction link
- Operating System: Linux
- Node Version: v18.20.3
- Nuxt Version: 3.15.3
- CLI Version: 3.20.0
- Nitro Version: 2.10.4
- Package Manager: [email protected]
- Builder: -
- User Config: devtools, compatibilityDate, modules
- Runtime Modules: @nuxtjs/[email protected]
- Build Modules: -
Reproduction
https://stackblitz.com/edit/github-s7wzzz7d-dv2yxgpx?file=components%2FMyComponent.vue
Describe the bug
Coming from this nuxt-i18n issue, I tried diving a bit deeper into the problem, and I think there are multiple vue instances being initialized in the test environment causing this issue. See in this reproduction.
The instance we get from the nuxtApp.vueApp is different than the one we get from getCurrentInstance when we mount the environment in a unit test which is not the case if we run the app normally.
From my understanding, the i18n module installs the i18n instance to the one from nuxtApp, but uses getCurrentInstance within the useI18n composable which causes this issue.
Additional context
I first added this as a comment on the nuxt-i18n issue but I thought it would make more sense to open an issue here
Logs