-
Notifications
You must be signed in to change notification settings - Fork 307
Speed up sourcemap lookups by checking existence of .map files #1780
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
Conversation
fileContents = await readfile(compiledPath); | ||
let sourceMapUrl; | ||
const possibleSourceMapURL = `${compiledPath}.map`; | ||
if (await fsUtils.exists(possibleSourceMapURL)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than making a separate exists
call here, you can pass the siblings elements of the directory to the fileProcessor
function.
It's called by readSomething
which is called for the root entry (no siblings) and in handleDirectoryEntry
. In the latter case, it's called reading either from the cache tree (where Object.keys(cache.children)
are siblings) or from the filesystem (where files
are siblings)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. I'm not fully sure thou if you meant the same changes
Problem
Debugging experience is slow in large monorepos, since all the files are read to check location of sourcemap file
PR fix
Check if .map file exists for compiled file we don't need to read file to find location of sourcemap location.
Possible issue
If there is a js file and it has .map file which is not a sourcemap file with same js file name, it can lead to issue.
This however should be rare edge case.