Open flozero opened 3 years ago
I'm not sure why is that but just gonna add this extra screenshot:
@pi0 any extra considerations that have to be taken into account when using addTemplate
/ addPlugin
?
I also get this issue with:
nuxt: 2.15.3
nuxt-vite: 0.1.1
nuxt-i18n: 6.27.1
Use langDir
+ translation files seems to eliminate the error.
// nuxt.config.js
i18n: {
locales:
[{
code: 'zh',
file: 'zh-HK.js'
}, {
code: 'en',
file: 'en-GB.js'
}],
defaultLocale: 'zh',
langDir: 'lang/', // <---
vueI18n: {
fallbackLocale: 'zh',
}
},
// lang/en-GB.js
export default {
welcome: 'Welcome'
}
// package.json
"nuxt": "^2.15.7",
"nuxt-vite": "^0.1.0",
"nuxt-i18n": "^6.27.2",
It looks like the plugin checks for langDir
before exporting localeMessages
in options.js
// node_modules/nuxt-i18n/src/templates/options.js
if (langDir) { %>
export const localeMessages = {
...
See documentation for landDir option and translation files https://i18n.nuxtjs.org/options-reference#langdir https://i18n.nuxtjs.org/lazy-load-translations/
Thanks for that. So it's actually an issue with nuxt-i18n. Fixing in https://github.com/nuxt-community/i18n-module/pull/1251.
Versions
nuxt-vite: 0.1.1 nuxt: 2.15.7
Reproduction
Non-existent export 'localeMessages' is imported from resources/assets/js/.nuxt/nuxt-i18n/options.js
Description