diff --git a/scripts/installer/update.mjs b/scripts/installer/update.mjs index 9822eb1..7907913 100644 --- a/scripts/installer/update.mjs +++ b/scripts/installer/update.mjs @@ -419,7 +419,8 @@ async function performUpdate() { } // Backup critical files for potential rollback - const criticalFiles = ['package.json', 'package-lock.json', 'dist'] + // FIXED: Don't backup dist/ - it must be rebuilt from new source code + const criticalFiles = ['package.json', 'package-lock.json'] for (const file of criticalFiles) { const srcPath = join(process.cwd(), file) if (!existsSync(srcPath)) continue @@ -435,6 +436,16 @@ async function performUpdate() { } } + // CRITICAL FIX: Delete old dist/ before update to force clean rebuild + const oldDistPath = join(process.cwd(), 'dist') + if (existsSync(oldDistPath)) { + try { + rmSync(oldDistPath, { recursive: true, force: true }) + } catch { + // Continue - build will overwrite anyway + } + } + // Step 3: Download latest code from GitHub process.stdout.write('📥 Downloading...') const repoOwner = 'Obsidian-wtf'