feat: narrow outFiles to workspace dependencies in npm/yarn monorepos - #2398
Open
Aparajith (Aparajith24) wants to merge 1 commit into
Open
feat: narrow outFiles to workspace dependencies in npm/yarn monorepos#2398Aparajith (Aparajith24) wants to merge 1 commit into
Aparajith (Aparajith24) wants to merge 1 commit into
Conversation
In a monorepo using npm/yarn `workspaces`, outFiles previously fell back to scanning the entire opened folder for sourcemaps, since the debugged program already lives inside it. Detect a `workspaces` root and narrow outFiles to the debugged package plus its workspace-local dependencies instead. Fixes microsoft#1730
Author
@microsoft-github-policy-service agree |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 an npm/yarn
workspacesmonorepo,outFileswas previously left to fall back to scanning the entire opened folder for sourcemaps. This happened because the widen-only logic inguessOutFilesonly kicks in when the debugged program lives outside the opened workspace folder, but in a monorepo, the folder VS Code has open typically is the repo root, so the program is always "inside" it and the widen logic never narrows anything. The result: debugging one package in a large monorepo scanned every other unrelated package's compiled output too, making it slow to hit breakpoints.This adds a narrower path: when the opened workspace folder itself has a "workspaces" field in its "package.json" (npm/yarn workspaces), we:
outFilesto just the debugged package plus those workspace-local dependencies, instead of the whole repo.This only applies when outFiles isn't already set by the user (same guard the existing widen-only logic uses), so anyone with a manually configured outFiles is unaffected. Projects without a workspaces field are also completely unaffected, this is additive, not a change to existing behavior.
Closes #1730