From 023f1bd60c0abea87e91a534bbca0abcdf83fec3 Mon Sep 17 00:00:00 2001 From: OKAMOTO Shigehiro Date: Sat, 3 Feb 2024 06:30:44 +0900 Subject: [PATCH] fix a build error in some cases --- src/utils/i18n/core/integration.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utils/i18n/core/integration.ts b/src/utils/i18n/core/integration.ts index a5e9899..4e9de75 100644 --- a/src/utils/i18n/core/integration.ts +++ b/src/utils/i18n/core/integration.ts @@ -43,6 +43,16 @@ export default function i18nPlus({ locales, POSIXlocalesMap, defaultLocale }: i1 .filter((i) => i !== defaultLocale) .forEach((locale) => { const locale_dir = dir.pathname + locale; + try { + const target = fs.statSync(`${locale_dir}/404`); + if (!target.isDirectory()) { + console.log(`Skip "${locale}"`); + return; + } + } catch (err) { + console.log(`Skip "${locale}"`); + return; + } fs.rename(`${locale_dir}/404/index.html`, `${locale_dir}/404.html`, (err) => { if (err) { console.log("Failed to rename path of 404 files");