Bugfix: How to fix 'Source and destination must not be the same' err...
Documentation for Sessions
🐛 Bugfix: How to fix 'Source and destination must not be the same' err...
Date: 2026-02-25
Time: 21:36:03 UTC
Session: gspace1-142.7
Agent: angular
Confidence: 97%
Status: ✅ Documented
📋 Decision Context
Question:
How to fix 'Source and destination must not be the same' error in build-angular-library.js on Windows?
Task: Fix Vitto Desktop CI/CD release workflow
🎯 Decision Made
Chosen:
Replace
file.replace(libPath, distPath)withpath.join(distPath, path.relative(libPath, file))for both HTML and SCSS file output path calculation.
Options Considered:
- path.join(distPath, path.relative(libPath, file)) (cross-platform — chosen)
- Normalize both paths with path.normalize() before replace
- Use regex replace with [/\] separator pattern
- Use path.posix.relative for consistent forward slashes
💭 Reasoning
On Windows, findFiles() returns paths with backslashes (e.g., 'libs\libs-ux\ux-utils-lib\src\file.html') but libPath uses forward slashes ('libs/libs-ux/ux-utils-lib'). String.replace() doesn't match because the separators differ, so outputPath equals the input path (no substitution). fs.copy() then fails because source === destination. Using path.relative() + path.join() is cross-platform — path.relative() handles mixed separators correctly, and path.join() uses the OS-native separator.
📁 Files Involved
tools/scripts/build/build-angular-library.js
🔗 Related
- Decision ID:
dev_1772055363945_8wdmmlv - Session: 142
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation