fix: migrate import.meta.glob

This commit is contained in:
Anthony Fu committed 2022-07-14 03:19:15 +08:00
1 parent a56c80efa2
commit c316ca945c
2 files changed
+4 -2

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ import { type UserModule } from '~/types'
// Don't need this? Try vitesse-lite: https://github.com/antfu/vitesse-lite
const messages = Object.fromEntries(
Object.entries(
import.meta.globEager('../../locales/*.y(a)?ml'))
import.meta.glob<{ default: any }>('../../locales/*.y(a)?ml', { eager: true }))
.map(([key, value]) => {
const yaml = key.endsWith('.yaml')
return [key.slice(14, yaml ? -5 : -4), value.default]