-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Typescript recompile app two times in watch mode with non recursive watching on os like linux #37994
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
Comments
This does not repro with build from master. |
So, I have to upload built version? |
Did you try |
I removed typescript from
my output:
after updating main.ts file and saving:
Also I pushed this updated project: https://github.com/baleksandr48/tsc-bug |
I am experiencing an issue that I think is related to this issue. ProblemWhen the node app runs, it ensures a directory exists in CWD (set to What should happen: CauseSee my diagnostics below, but possible cause also present in logs above. Just after the project has been compiled and the time diagnostics are printed. One additional directory watch is created, on the project root dir. This recursive watch causes the SolutionEither (allow for) exclude of Environmentpackage.json{
"name": "storage-api",
"version": "1.0.0",
"main": "dist/index.js",
"author": "SNIP",
"license": "SNIP",
"scripts": {
"serve": "tsc-watch --extendedDiagnostics --listEmittedFiles --noClear --onSuccess \"sh -c 'cd dist && node ./index.js'\"",
"build": "tsc"
},
"dependencies": {
"body-parser": "^1.19.0",
"express": "^4.17.1"
},
"devDependencies": {
"@types/express": "^4.17.6",
"@types/node": "^13.13.5",
"tsc-watch": "^4.2.3",
"tslint": "^6.1.2",
"typescript": "^3.8.3"
}
} Installed package versions
Compilation logNotes: running inside a docker composition (image:
|
I just found a workaround for my issue, should it help those reading along. I changed my structure to make the Changes to "scripts": {
"serve": "tsc-watch --project ./src --extendedDiagnostics --listEmittedFiles --noClear --onSuccess \"sh -c 'cd dist && node ./index.js'\"",
"build": "tsc --project ./src"
}, Changes to "outDir": "../dist", |
If it helps: I encountered this problem on our project using 3.8.3.
|
I forgot to mention that this issue is introduced by delayed child watcher updates (#35615) |
…recursively, send the updates to fileNames only Fixes #37994
* If there is no changes to folder structure when watching directories recursively, send the updates to fileNames only Fixes #37994 * Ignore excluded directories from wild card watching * Testcase showing that renaming file with non sync directory watcher displays correct error in the end Testcase for #38684
This is still happening for me on TypeScript 4.1.3. Is the fix included in that release? |
I've created simple application and run command
tsc -w
.Expected behavior:
Application have to be compiled. Any changes in the code have to lead to recompile.
Actual behavior:
Application compiled. Any changes in the code lead to double recompiling.
Playground Link:
I have created public repo: https://github.com/baleksandr48/tsc-bug You can clone it, run
npm i
andnpm run build:watch
I googled a lot of info during the day, tried to update tsc version, reinstalled modules, excluded different directories in ts.config but nothing helps.
P.S. there is only ONE compiling if I run
nodemon --watch 'src/**/*.ts' --exec 'tsc' -e ts
The text was updated successfully, but these errors were encountered: