Cannot read properties of undefined (reading 'VITE_LARAVEL_VUE_I18N_HAS_PHP')
See original GitHub issue- laravel-vue-i18n - 2.1.1
- vite - 2.9.9
- vuejs 3.2.25
- node 16.16.0
- without laravel
// .env
VITE_LARAVEL_VUE_I18N_HAS_PHP=false
// src/main.ts
import { createApp } from 'vue'
import { i18nVue } from 'laravel-vue-i18n'
import i18nOptions from '@/utils/lang'
import pinia from '@/utils/pinia'
createApp(App)
.use(i18nVue, i18nOptions(pinia))
// src/utils/lang
import { Pinia } from 'pinia'
import { useSettingsStore } from '@/stores/settings'
export default (pinia: Pinia) => {
const lang = useSettingsStore(pinia).locale
const resolve = async (lang: string) => {
const files = import.meta.glob('../../lang/*.json')
return await files[`../../lang/${ lang }.json`]()
}
return { lang, resolve }
}
Result: not working
If we add output to the console, we see that the files are loaded:
const resolve = async (lang: string) => {
const files = import.meta.glob('../../lang/*.json')
console.log(files)
console.log(
import.meta.env.VITE_API_URL,
import.meta.env.VITE_LARAVEL_VUE_I18N_HAS_PHP
)
return await files[`../../lang/${ lang }.json`]()
}
Without the VITE_LARAVEL_VUE_I18N_HAS_PHP
key, I also get the error:
Version 1.4.4 worked perfectly.
Issue Analytics
- State:
- Created a year ago
- Comments:19 (19 by maintainers)
Top Results From Across the Web
Getting "Cannot read properties of undefined ... - Stack Overflow
I am creating library for card using components, creating 3 components. card-body; card-header; card-footer when I try to build the library, it ...
Read more >Why is the error "Cannot read properties of undefined (reading ...
I'm building a LWC to be used as a flow screen component. In the LWC, I allow the border color of the component...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >TypeError: Cannot read properties of undefined (reading 'post ...
Unfortunatelly, I receive the type error as follows: TypeError: Cannot read properties of undefined (reading 'post') I tried wit...
Read more >Cannot read properties of undefined (reading 'nameMap')
As soon as I set the value of one of the variable via ATF, I am getting below error: Cannot read properties of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Awesome, will tag it
Thanks for the PR, can you try again, and let me know?