vue-i18n 8.28.2 not working with vite (Vue 2.7), error "Uncaught TypeError: Vue is undefined"
Opened this issue · 0 comments
Thomas-1985 commented
Reporting a bug?
I am migrating a vue-cli v5/webpack project to vite (preparation before i want to migrate to Vue 3).
Whenever i run vite
, the app doesn't load in the browser. Instead i see a Uncaught TypeError: Vue is undefined
from vue-i18n, see attached screenshots
Expected behavior
It works like with webpack/vue-cli (v5)
Reproduction
src/main.ts
import { i18n } from '@/i18n';
...
Vue.use(VueI18n);
...
new Vue({
// eslint-disable-next-line
// @ts-ignore
vuetify,
router,
i18n,
pinia,
async created () {
// Interceptors Init
httpClient.interceptors()
},
render: (h) => h(App)
}).$mount('#app')
src/i18n/index.tx
import VueI18n from 'vue-i18n';
import { mergeTranslations } from '@/services/i18n';
export const i18n = new VueI18n({
locale: 'en',
fallbackLocale: 'en',
messages: mergeTranslations()
})
System Info
vue: 2.7.10
vue-i18n: 8.28.2
Browsers tested: Firefox, Chrome
Screenshot
Additional context
No response
Validations
- Read the Contributing Guidelines
- Read the Documentation
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussions