-
Notifications
You must be signed in to change notification settings - Fork 12.8k
tsc -w should not recompile if a file is created into an excluded folder #27279
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 is by design. Normally even though file is excluded by the config file, it could get included by module resolution and could be missing. So we cant just ignore file addition or removal of file in exclude directory. |
Any proposals on how to solve the problem, if this is by design so? It's still a problem, makes file upload testing impossible with watch |
Would very much appreciate some solution to this as well. |
@sheetalkamat the excluded file should be part of the build, yes - but it should not trigger a rebuild on change if it is excluded. |
I've been dealing with this issue on two separate projects. Nest uses |
also experiencing this issue, also with nest - we are using sqlite and any database update is triggering a rebuild and thus a server restart. |
Same issue here. Anyone is able to solve this? |
same here |
Same issue here. With Nest.js. |
Exactly the same issue with LevelDB and NestJS |
I have the same problem with Nest JS, and no solution for this is making the development for certain cases like simple file upload a real pain. There is a solution in this comment |
Solved it. And put your upload directory inside of dir for example. |
The approach in #27279 does not resolve this issue for me. I'm running tsc -w and webpack side-by-side, with tsc purely checking for ts errors and webpack producing a js bundle. Every time webpack places a new hot-update.js or hot-update.json file in the build folder, that triggers tsc to recompile. I've confirmed this with the DirectoryWatcher:: Triggered with /Users/{redacted}/GitHub/{redacted}/packages/{redacted}/build/main.852665aec4d5e06ecc09.hot-update.js My tsconfig: {
...
"include": ["packages/*/src/**/*"]
} Please give us a way to control which files can or cannot trigger a recompile! |
this seems poorly designed. I do not think the stated reason is sufficient. shift the burdon/power to the developers by allowing this exclusion in watch mode. |
I'm hopeful that #39030 will fix this (merged, but not released yet). |
If anyone is still facing the same issue, I solved this by adding the |
It doesn't work for me {
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noImplicitAny": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"resolveJsonModule": true,
"strictNullChecks": false,
},
"exclude": ["node_modules", "dist", "data", "uploads"],
"include": ["src"]
}
|
having same issue.
even tho the files are being generated within |
Same happening here with Nest.js. Writing a buffer into a file will make the whole project to recompile thus cutting the writing process. So irritating. My solution was using a hidden folder /.downloads/ That way it is excluded by default, in case that helps anyone! |
Ignoring mydb.sqlite-journal worked for me with excludeFiles in tsconfig.json. My issue was that another package using the database package triggered the depenency, and so had to use .. to navigate to the files that triggered the change. Used tsc --watch --extendedDiagnostics to see the files that triggered the rebuild. "watchOptions": {
"excludeFiles": [
"prisma/mydb.sqlite-journal",
"../database/prisma/mydb.sqlite-journal",
"../../node_modules/@repo/db/prisma/mydb.sqlite-journal",
"**/mydb.sqlite-journal"
]
} |
Search Terms:
tsc -w watch exclude subfolder recompile
tsconfig.json
Folder structure

Expected behavior:
When i create a file into
upload/
, tsc should not detect file changes.Actual behavior:
When i create a file into

upload/
, server detects file changes and do incremental compilation.i'm using
"tsc-watch --onSuccess \"node dist/server.js\""
, so, my server is restarted whenever user upload a file.Is there any way to tsc -w not detect file creation in an excluded project's subfolder?
Thanks in advance.
The text was updated successfully, but these errors were encountered: