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
+7 -7
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