Fix issue where we were sometimes filtering out certain node modules innapropriately. (#1807)

This commit is contained in:
CyrusNajmabadi 2018-08-21 15:35:37 -07:00 committed by GitHub
parent 734f7beba7
commit 4dab630a1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,8 +79,13 @@ export async function computeCodePaths(
function isSubsumedByHigherPath(path: string, pathSet: Set<string>): boolean {
for (const otherPath of pathSet) {
if (path.length > otherPath.length && path.startsWith(otherPath)) {
return true;
if (path.length > otherPath.length &&
path.startsWith(otherPath)) {
// Have to make sure we're actually a sub-directory of that other path. For example,
// if we have: node_modules/mime-types, that's not subsumed by node_modules/mime
const nextChar = path.charAt(otherPath.length);
return nextChar === "/" || nextChar === "\\";
}
}