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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In mono repo scenarios the packages are linked using symlink.
So when trying to resolve package1 from package2 in the test we look for locations like: /home/src/projects/project/node_modules/package1/dist/index.d.ts
As a result when package1 fails to resolve, we want to watch if this path will exists.
Before this PR, we would be watching /home/src/projects/project/node_modules as its a node_modules folder and we dont want to be watching too many packages or folders. This results in issues because /home/src/projects/project/node_modules/package1 is a symlink and any changes to the target are not percolated to the watcher we create. So without this PR we would not see the changes and miss the package build and report errors about package1 not found and never be able to resolve that unless offcourse if you start fresh by restarting tsserver
Now when we calculate dir to watch, we also find the packageDir if this happens to be symlink, we will watch it otherwise we will watch the node_modules like we use to watch before.
Other change needed for this to work on linux was that when we are watching this symlink dir, we need to ensure we are watching the target recursively as that is the expectation for native watchers that support symlink watching.
We already had test case which didnt update the diagnostics on tsserver when paths was not used and with my other prototype changes to treat file create and delete as change and retain things more, it becomes more evident and those tests just start to fail. So this is cruicial fix for that change to go in as well
The reason will be displayed to describe this comment to others. Learn more.
For these new watchers, my impression is that they are attempting to watch the future linking or changing of /user/username/projects/myproject/packages/B, right? Does the case matter here?
@sheetalkamat So this fix is already in prod?
Just switched to TS 5.5.3
Quick question: does it work only with .ts files imported from symlinked folder, or any .js files (for example from node_modules/@libraryname/{some_symlinked_folder}/dist/some_compiled_lib.js ?
Still having the issue with VSCode. One of my node_modules packages - node_modules/@libraryname/package is a symbolic link to another folder. If files are changed in that folder, should it detect changes?
P.S.: checked and it still does not, I need to call restart TS server in VSCode
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In mono repo scenarios the packages are linked using symlink.
So when trying to resolve
package1
frompackage2
in the test we look for locations like:/home/src/projects/project/node_modules/package1/dist/index.d.ts
As a result when
package1
fails to resolve, we want to watch if this path will exists.Before this PR, we would be watching
/home/src/projects/project/node_modules
as its anode_modules
folder and we dont want to be watching too many packages or folders. This results in issues because/home/src/projects/project/node_modules/package1
is a symlink and any changes to the target are not percolated to the watcher we create. So without this PR we would not see the changes and miss the package build and report errors aboutpackage1
not found and never be able to resolve that unless offcourse if you start fresh by restarting tsserverNow when we calculate dir to watch, we also find the
packageDir
if this happens to be symlink, we will watch it otherwise we will watch thenode_modules
like we use to watch before.Other change needed for this to work on linux was that when we are watching this symlink dir, we need to ensure we are watching the target recursively as that is the expectation for native watchers that support symlink watching.
We already had test case which didnt update the diagnostics on tsserver when
paths
was not used and with my other prototype changes to treat file create and delete as change and retain things more, it becomes more evident and those tests just start to fail. So this is cruicial fix for that change to go in as wellFixes #55450