Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Cannot use vue-i18n-composable with vue-cli v4.5.19 #21

Open
haugero opened this issue Aug 19, 2022 · 5 comments
Open

Cannot use vue-i18n-composable with vue-cli v4.5.19 #21

haugero opened this issue Aug 19, 2022 · 5 comments

Comments

@haugero
Copy link

haugero commented Aug 19, 2022

I want to use your vue-i18n-composable with vue 2.7 and vue-i18n v8 in my vue project.
But I get the following error:

Uncaught TypeError: Cannot read properties of undefined (reading 'config')
    at VueI18n._initVM (vue-i18n.common.js?08a3:1355:1)
    at new VueI18n (vue-i18n.common.js?08a3:1294:1)
    at createI18n (index.mjs?6239:6:1)
    at eval (main.ts?e4f2:11:1)
    at ./src/main.ts (app.js:1183:1)
    at __webpack_require__ (app.js:854:30)
    at fn (app.js:151:20)
    at 1 (app.js:1244:18)
    at __webpack_require__ (app.js:854:30)
    at checkDeferredModules (app.js:46:23)

I configure vue-i18n like it is described in the README and yes, I do use Vue.use(VueI18n);

To reproduce the issue I have created 2 projects from scratch.
If I build the project with vue-cli v5 everything works BUT with vue-cli v4 I get the mentioned error.

To reproduce the error I have created https://github.com/haugero/vue2.7-vue-i18n-composable

I think it should also work with vue-cli 4 or?

@Luminescenciya
Copy link

I have the same issue, but also i found that after "new VueI18n" code running at "vue-i18n.esm.js", but after "createI18n" it goes to "vue-i18n.common.js". Maybe it will help

@karladler
Copy link

For me the problem was indeed, that I had my createI18n function in an extra file and that had been executed BEFORE Vue.use(VueI18n). When I added Vue import and called it before createI18n({... it worked fine again.

@gavmck
Copy link

gavmck commented Oct 26, 2022

I'm getting this with @vue/[email protected], but using storybook.
I tried the simple reproduction repo, which does indeed work when you update to 5.0.8.

@gavmck
Copy link

gavmck commented Oct 26, 2022

@Luminescenciya that pointed me in the right direction, I forced the vue-i18n file using webpacks alias's

'vue-i18n': path.join(__dirname, '../node_modules/vue-i18n/dist/vue-i18n.js'),

@zaxlct
Copy link

zaxlct commented Nov 16, 2022

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants