-
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
Typescript Watch - Cleaning Target Files on Source Deletion #16057
Comments
For |
Is there a recommended way to work around this today? We have prepended But this is caused problems with sym-linked modules. The importing project's watch then gets broken with |
Can someone provide some pointers where I can help implement this? @mhegazy? |
Things have gotten a bit more complicated with the addition of the Builder the and the WatchProgram (see #20234), there is not really a place to keep this information, since it is always partial, and we are not rebuilding the information after every change as we used to do. I suppose we could investigate restarting the builder if a file was removed. but we will need a way to detect that in the first place.. |
Hi! This is constantly biting us during development. A file is removed - but nightwatch / some other library still picks it up and runs tests based on code that should not be there. Last activity on this was more than 8 months ago, but I hope there is still a possibility for this to be added? Thanks! |
If you're using jest, you can use ts-jest |
My 'solution' is obviously not the full thing that is trying to be implemented right now, it's just some very basic behavior I need myself, But I think it might help some people that need something like this right now. So if it's alright, I will just leave a link here for now: https://www.npmjs.com/package/ts-cleaner |
This functionality would also be helpful on a simple |
|
Hello!!
package.json
|
For cleaning up of not actual compilation results I use this https://github.com/whitecolor/ts-clean-built |
Any update on this one? It's still causing a headache... |
Still causing problems... |
I would think this feature could use the build info from —incremental to know what needs to be deleted. |
Any updates on this? |
Also facing this problem, would be a very nice addition |
Bump |
Just wanted to add that none of the 3rd party library workarounds mentioned above take care of cleaning up the |
I found this issue after a bit of searching since this is still a very common source of bugs and poses an unfortunate workflow problem with My question here is, why would our approach be to maintain a list of files necessarily? The underlying FS watch should receive events on file deletion or move (typically a "rename" event). On rename, we simply check if a corresponding JS file exists in the |
This a daunting issue, especially if you refactor often, which you should! And this, is the story about my pursuit to fixing it, the 2023 way! Of course with the help of AI, ChatGTP in particular. So keep reading... Initially, I googled the issue with I followed more links but none seemed like solving the problem inherently: Reading the current issue, I found ts-clean-built to be the best solution & project around at this time. Before even giving it a spin, with only issue, it seemed it would save me hours of wasted effort ;-) But don't we all have ChatGPT plugins right now, next to the google search? It's just a click away, or as a paid customer you get ALWAYS ChatGPT's answer. Which read as:
Wow! Is that true? Did Chat GPT overwhelmingly solved my ;issue with one So I immediately added the
ChatGPT let down No 1. For a start, So, lets try again:
And this time I get:
Why so stringent? Another try...
Guess what! Two errors this time!
Ok, I had enough! In any case, So I tried on last thing, although I was sure its doomed. According to ChatGPT The --removeComments flag removes all comments from the output files and also removes any files that no longer exist in the source directory.. Lets see: As one would expect, it doesn't, it is just to So ChatGPT lied and tried to fool me twice in one problem, as many as the solutions! Welcome to the Brave New World of lies, AI powered! TypeScript team, please, please solve this issue! Till then I'm going for |
To anyone looking for a solution, I've completely stopped using I don't know if it is as efficient as {
"name": "myproject",
"scripts": {
"watch": "chokidar \"src/*\" \"tsconfig.json\" -c \"npm run build\" --initial",
"build": "rimraf dist && tsc"
},
"devDependencies": {
"@types/node": "^20.11.17",
"chokidar-cli": "^3.0.0",
"rimraf": "^5.0.5",
"typescript": "^5.3.3"
}
} |
For anyone have this problem like me, i have made a library to solve this, and many more, take a look. typemon |
Can we add a compiler option to also glob-delete a target file when the source file is removed? We run into this constantly and have to gulp clean frequently - it makes the usage of
tsc -watch
pointless as we have to constantly purge the output directory.The text was updated successfully, but these errors were encountered: