-
Notifications
You must be signed in to change notification settings - Fork 59
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
Feature request: "onBeforeCompilation" or "cleanOutDir" option #93
Comments
I ran into a bug using tsc-watch today and it was because of old files in my outDir. |
In the current situation, I don't think that it's possible to halt the compilation before it starts... |
Yeah I took at peek at the code and realized you don't really have a clean hook--you can close this. I am dynamcially loading a directory of imports (handlers). That's how I noticed old files/handlers were still active with new builds where the files have been deleted. I think the best that tsc-watch could do would be: flag a warning after each "Success" to inform the user if there are files in outDir which have a "created date" significantly far way from compile completion. In my case when inspecting the outDir manually it was pretty easy to see that almost every file had an created date of 1:31pm, but a few files had 1:25pm or even earlier. Hard to say what the default threshold should be... So I don't have a PR for you... but perhaps a flag like |
But as said before typescript supports incremental compilation, meaning that files will have totally different times... |
One of the big pain points in using any kind of "watcher" with typescript is: cleaning up the output folder before compilation begins.
See related issue: microsoft/TypeScript#16057
It would be nice of tsc-watch gave us the capability to run something before every compilation. Perhaps a --cleanOutDir flag that would clean the output folder every time before compilation. Or a --onBeforeCompilation option that would allow us to run some custom code. Or both!
The text was updated successfully, but these errors were encountered: