You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the behavior in every version I tried, and I reviewed the FAQ for entries about Common "Bugs" That Aren't Bugs and Common Feature Requests
💻 Code
Here is my tsconfig.json
{
"include": ["src", "types"],
"exclude": ["node_modules"],
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"moduleResolution": "node",
"jsx": "preserve",
"baseUrl": "./",
/* paths - import rewriting/resolving */
"paths": {
// If you configured any Snowpack aliases, add them here.
// Add this line to get types for streaming imports (packageOptions.source="remote"):
// "*": [".snowpack/types/*"]
// More info: https://www.snowpack.dev/guides/streaming-imports
},
/* noEmit - Snowpack builds (emits) files, not tsc. */
"noEmit": true,
/* Additional Options */
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"importsNotUsedAsValues": "error",
"noUnusedLocals": false
},
"watchOptions": {
// Use native file system events for files and directories
"watchFile": "useFsEvents",
"watchDirectory": "useFsEvents",
// Poll files for updates more frequently
// when they're updated a lot.
"fallbackPolling": "dynamicPriority",
// Don't coalesce watch notification
"synchronousWatchDirectory": true,
// Finally, two additional settings for reducing the amount of possible
// files to track work from these directories
"excludeDirectories": ["node_modules", "_build"],
"excludeFiles": ["build/fileWhichChangesOften.ts"]
}
}
You can check the number of file watcher using the following command in Linux find /proc/*/fd -user "$USER" -lname anon_inode:inotify -printf '%hinfo/%f\n' 2>/dev/null | xargs cat | grep -c '^inotify'
Check before and after you open a folder in your editor.
But the moment I open vscode or any editor using tsserver (I tested Emacs and Vim) the number of file watchers increases to 5000. Despite me having only 1 source file. Obviously it includes the node_modules folder.
Using any of the options provided by the editors to exclude folders doesn't work. But that is expected because they can't control what files tsserver is watching. They can just hide any problems that are reported.
🙂 Expected behavior
tsserver should respect the exclude options in tsconfig.json and not include node_modules.
The text was updated successfully, but these errors were encountered:
@MartinJohns Deleting every single file in the src folder and creating a new file with nothing imported also gives me 4592 inotify watchers.
The typescript compiler tsc does respect the watch exclude options. Using tsc --watch without the watch exclude options creates 4588 inotify watchers. But with the watch exclude options, it creates only 206.
tsserver, with or without the watch exclude options creates 4598 inotify watchers. Clearly indicating that it is including every single node_modules file and ignoring the options.
Bug Report
🔎 Search Terms
tsserver exclude watch
🕗 Version & Regression Information
💻 Code
Here is my tsconfig.json
You can check the number of file watcher using the following command in Linux
find /proc/*/fd -user "$USER" -lname anon_inode:inotify -printf '%hinfo/%f\n' 2>/dev/null | xargs cat | grep -c '^inotify'
Check before and after you open a folder in your editor.
🙁 Actual behavior
I have tried various options suggested in https://www.typescriptlang.org/docs/handbook/configuring-watch.html and https://www.typescriptlang.org/docs/handbook/tsconfig-json.html for excluding the node_modules folder.
But the moment I open vscode or any editor using tsserver (I tested Emacs and Vim) the number of file watchers increases to 5000. Despite me having only 1 source file. Obviously it includes the node_modules folder.
Using any of the options provided by the editors to exclude folders doesn't work. But that is expected because they can't control what files tsserver is watching. They can just hide any problems that are reported.
🙂 Expected behavior
tsserver should respect the exclude options in tsconfig.json and not include node_modules.
The text was updated successfully, but these errors were encountered: