fix(TsCompiler): Clear output directories before compilation to ensure clean builds and avoid stale files
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tsbuild',
|
||||
version: '3.1.3',
|
||||
version: '4.0.2',
|
||||
description: 'A tool for compiling TypeScript files using the latest nightly features, offering flexible APIs and a CLI for streamlined development.'
|
||||
}
|
||||
|
||||
@@ -335,6 +335,14 @@ export class TsCompiler {
|
||||
// Get destination directory as absolute path
|
||||
const destDir = smartpath.transform.toAbsolute(destPath, this.cwd) as string;
|
||||
|
||||
// Clear the destination directory before compilation if it exists
|
||||
if (await FsHelpers.directoryExists(destDir)) {
|
||||
if (!isQuiet && !isJson) {
|
||||
console.log(`🧹 Clearing output directory: ${destPath}`);
|
||||
}
|
||||
await FsHelpers.removeDirectory(destDir);
|
||||
}
|
||||
|
||||
// Update compiler options with the output directory
|
||||
const options: CompilerOptions = {
|
||||
...customOptions,
|
||||
|
||||
Reference in New Issue
Block a user