tsc incremental build clean output file on source file deletion

281 Views Asked by At

I'm experimenting with incremental build to speed up generating .js from .ts in a large project for local and CI processes. But, I'm facing an issue where deleting a source file doesn't delete the corresponding .js file during incremental build. This is causing problems for me because If I have to clean the folder before every build, there would be no point in using the incremental build feature.

Example:

.
├── bar.ts
├── foo.ts
├── index.ts
├── package.json
└── tsconfig.json

After build npx tsc --build --incremental ./

.
├── bar.js
├── bar.ts
├── foo.js
├── foo.ts
├── index.js
├── index.ts
├── package.json
├── tsconfig.json
└── tsconfig.tsbuildinfo

Now delete bar.ts and run npx tsc --build --incremental ./

.
├── bar.js
├── foo.js
├── foo.ts
├── index.js
├── index.ts
├── package.json
├── tsconfig.json
└── tsconfig.tsbuildinfo

bar.js won't be deleted.

Is there anything missing in the CLI argument? There is no information about it in the documentation.

0

There are 0 best solutions below