Skip to content

Commit 2dd4f13

Browse files
committed
fix: compatible with lower version node
1 parent 3498eb1 commit 2dd4f13

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

utils/getLanguage.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ function getLocale() {
107107
}
108108

109109
async function loadLanguageFile(filePath: string): Promise<Language> {
110-
return (await import(pathToFileURL(filePath).toString(), { with: { type: 'json' } })).default
110+
return await fs.promises.readFile(filePath, 'utf-8').then((data) => {
111+
const parsedData = JSON.parse(data)
112+
if (parsedData) {
113+
return parsedData
114+
}
115+
})
111116
}
112117

113118
export default async function getLanguage(localesRoot: string) {

0 commit comments

Comments
 (0)