Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue-i18n 8.28.2 not working with vite (Vue 2.7), error "Uncaught TypeError: Vue is undefined" #2009

Open
4 tasks done
Thomas-1985 opened this issue Nov 11, 2024 · 0 comments
Labels
Status: Review Needed Request for review comments

Comments

@Thomas-1985
Copy link

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

vue-i18n error 1
vue-i18n error 2

Additional context

No response

Validations

@Thomas-1985 Thomas-1985 added the Status: Review Needed Request for review comments label Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Review Needed Request for review comments
Projects
None yet
Development

No branches or pull requests

1 participant