From 277522fb1f613d688e80cf21b1eeda18b7425761 Mon Sep 17 00:00:00 2001 From: Qrac Date: Mon, 9 May 2022 18:10:33 +0900 Subject: [PATCH] Added confirmation of directory existence --- package.json | 2 +- src/generate.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d17a984..5e5948a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "minista", "description": "Next.js Like Development with 100% Static Generate", - "version": "2.4.0", + "version": "2.4.1", "bin": { "minista": "./bin/minista.js" }, diff --git a/src/generate.ts b/src/generate.ts index af19183..e2f11ec 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -1,6 +1,7 @@ import type { UserConfig as ViteConfig, InlineConfig } from "vite" import type { Options as MdxOptions } from "@mdx-js/esbuild" +import fs from "fs-extra" import path from "path" import url from "url" @@ -114,6 +115,14 @@ export async function generatePartialHydration( viteConfig: InlineConfig ) { const moduleDir = systemConfig.temp.partialHydration.outDir + "/modules" + + const moduleDirRelative = path.relative(".", moduleDir) + const moduleDirExists = fs.existsSync(moduleDirRelative) + + if (!moduleDirExists) { + return + } + const moduleFilePaths = await getFilePaths(moduleDir, "txt") if (moduleFilePaths.length === 0) {