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}(文件大小不一致)`); + } } } });