-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiler Option --outDir should remove existing files #13722
Comments
The compiler does not delete files. deleting files entails user data loss, and it is not usually a thing that compilers do. |
Ok, thanks |
this comment doesn't really line up with a compiler that can be (and is recommend to be) run in watch mode. In watch mode, the compiler is happy to overwrite files that it's generated, which entails the same amount of data loss. Deleting those files when the source files that generated them go away seems like the consistent thing to do, and needing to clean out all compiled files and start fresh seems like it defeats the purpose of incremental compilation with --watch. Would you be open to a PR supporting this behavior behind a flag? |
overwriting is different from deleting. deleting will have to be a complete directory, since the compiler does not what it wrote to it last time it ran. and deleting a whole folder is a very drastic action, and I would not be comfortable with a tool that does that un-announced. |
TypeScript Version: 2.1.4 on Windows 10
Expected behavior:
When running tsc -w with outDir set, it should remove existing files.
Actual behavior:
Old files are left in the output directory and it seems that sometimes they block the creation of the new files.
I do have other build tools watching the output directory and I wonder if this is a problem, because if I try to delete the folder manually while the build tools are running, I get a warning that the directory is locked.
The text was updated successfully, but these errors were encountered: