From 549c732d78b971da260d6b0803e2f985b599375b Mon Sep 17 00:00:00 2001 From: Sandy Tao Date: Thu, 15 Jan 2026 14:03:27 +0800 Subject: [PATCH] fix(build): clean dist directory before tsc build to prevent TS5055 When building multiple times consecutively, `tsc` would sometimes treat the previously generated `.d.ts` files in `dist/` as inputs, leading to the TS5055 overwrite error. Clearing the `dist` directory at the start of the build script ensures a clean slate and fixes this CI failure. --- scripts/build_package.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/build_package.js b/scripts/build_package.js index c201333d2c..966867e82d 100644 --- a/scripts/build_package.js +++ b/scripts/build_package.js @@ -18,7 +18,7 @@ // limitations under the License. import { execSync } from 'node:child_process'; -import { writeFileSync, existsSync, cpSync } from 'node:fs'; +import { writeFileSync, existsSync, cpSync, rmSync } from 'node:fs'; import { join, basename } from 'node:path'; if (!process.cwd().includes('packages')) { @@ -28,6 +28,9 @@ if (!process.cwd().includes('packages')) { const packageName = basename(process.cwd()); +// Clean the dist directory to prevent TS5055 overwrite errors during consecutive builds +rmSync(join(process.cwd(), 'dist'), { recursive: true, force: true }); + // build typescript files execSync('tsc --build', { stdio: 'inherit' });