From f1d1a56a779808e40fe992efb79ad9bf6f01ca5b Mon Sep 17 00:00:00 2001 From: LCJ-MinYa <1049468118@qq.com> Date: Thu, 20 Mar 2025 14:07:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20vite=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=EF=BC=8C=E5=AE=9E=E7=8E=B0=E5=A4=8D=E5=88=B6?= =?UTF-8?q?src=E4=B8=8B=E9=9D=A2=E7=9A=84md=E6=96=87=E4=BB=B6=E5=88=B0publ?= =?UTF-8?q?ic/md=E6=96=87=E4=BB=B6=E5=A4=B9=E4=B8=8B(=E4=BC=98=E5=8C=96)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/move-md-plugin.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build/move-md-plugin.ts b/build/move-md-plugin.ts index 1cff4d8..2de70f0 100644 --- a/build/move-md-plugin.ts +++ b/build/move-md-plugin.ts @@ -21,7 +21,16 @@ const moveMarkdownFiles = (dir: string) => { // 检查目标文件是否存在 if (!fs.existsSync(distPath)) { fs.copyFileSync(filePath, distPath); - console.log(`自定义vite插件,复制 ${filePath} 到 ${distPath}`); + console.log(`自定义vite插件,复制 ${filePath} 到 ${distPath}(新增)`); + } else { + // 比较文件大小 + const sourceFileSize = stat.size; + const distFileSize = fs.statSync(distPath).size; + + if (sourceFileSize !== distFileSize) { + fs.copyFileSync(filePath, distPath); + console.log(`自定义vite插件,复制 ${filePath} 到 ${distPath}(文件大小不一致)`); + } } } });