]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
fix: compatible with lower version node (#732)
authorbtea <2356281422@qq.com>
Mon, 7 Apr 2025 10:53:53 +0000 (18:53 +0800)
committerGitHub <noreply@github.com>
Mon, 7 Apr 2025 10:53:53 +0000 (18:53 +0800)
utils/getLanguage.ts

index 632efce2aa79fe1b09f49fe06c0c3004a10859d8..5b60fe38617e94f9c3ee4a0af2b5f58e4bc84b3c 100644 (file)
@@ -107,7 +107,12 @@ function getLocale() {
 }
 
 async function loadLanguageFile(filePath: string): Promise<Language> {
-  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) {