Skip to content

"tsc --project tsconfig.json --incremental" doesn't clean files from output folder. #36648

Closed
@trusktr

Description

@trusktr

TypeScript Version: 3.7.5

Search Terms:

tsc incremental doesn't clean old files

Code

N/A

Expected behavior:

When, for example, refactoring by renaming a file (and VS Code updates all import statements, etc), then the outputDir should not contain the old file.

Actual behavior:

The output directory contains old unused files.

Prior to trying incremental builds (today for the first time) I was simply doing rm -rf dist/ to "clean" it first. This doesn't work with incremental builds (#30602).

I tried running tsc --build --clean and tsc --build ./tsconfig.json --clean but those don't do anything, old files still remain in the output folder.

Note, I have a single tsconfig.json at the root of my project, and compile all my source code into a single output directory all at once with a single tsc command. I'm not "composing projects".

Playground Link:

N/A

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions