chore: remove eval dynamic import

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei 2024-09-15 14:58:46 +08:00
parent 4197824a25
commit 1720aec8af
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
1 changed files with 7 additions and 7 deletions

View File

@ -68,13 +68,13 @@ const langChangedHandler = async (lang: string) => {
}
}
} else {
const res = await eval(
`import('/locales/${lang}.js').then((res) => res?.default || res)`,
).catch(() => {
toast.error(`${t("common:tips.load-lng-error")}: ${lang}`)
loadingLangLock.delete(lang)
return {}
})
const res = await import(`/locales/${lang}.js`)
.then((res) => res?.default || res)
.catch(() => {
toast.error(`${t("common:tips.load-lng-error")}: ${lang}`)
loadingLangLock.delete(lang)
return {}
})
if (isEmptyObject(res)) {
return