Skip to content

Commit 8b42631

Browse files
Alex--Cpaulgv
authored andcommitted
fix: Wait for lazy loading promises (#163)
* Prevent "WARN Cannot stringify a function" * Make result const
1 parent 21d4305 commit 8b42631

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/templates/utils.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ export async function loadLanguageAsync (i18n, locale) {
2020
try {
2121
const module = await import(/* webpackChunkName: "lang-[request]" */ '~/<%= options.langDir %>' + file)
2222
const messages = module.default ? module.default : module
23-
i18n.setLocaleMessage(locale, typeof messages === 'function' ? await Promise.resolve(messages()) : messages)
23+
const result = typeof messages === 'function' ? await Promise.resolve(messages()) : messages
24+
i18n.setLocaleMessage(locale, result)
2425
i18n.loadedLanguages.push(locale)
25-
return messages
26+
return result
2627
} catch (error) {
2728
console.error(error)
2829
}

0 commit comments

Comments
 (0)