From: btea <2356281422@qq.com> Date: Mon, 7 Apr 2025 10:53:53 +0000 (+0800) Subject: fix: compatible with lower version node (#732) X-Git-Tag: v3.16.4~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3de8a5cbd737d19ab0c028589d9513ff1a1e36f3;p=thirdparty%2Fvuejs%2Fcreate-vue.git fix: compatible with lower version node (#732) --- diff --git a/utils/getLanguage.ts b/utils/getLanguage.ts index 632efce2..5b60fe38 100644 --- a/utils/getLanguage.ts +++ b/utils/getLanguage.ts @@ -107,7 +107,12 @@ function getLocale() { } async function loadLanguageFile(filePath: string): Promise { - return (await import(pathToFileURL(filePath).toString(), { with: { type: 'json' } })).default + return await fs.promises.readFile(filePath, 'utf-8').then((data) => { + const parsedData = JSON.parse(data) + if (parsedData) { + return parsedData + } + }) } export default async function getLanguage(localesRoot: string) {