Skip to content

Commit 6076e90

Browse files
committed
refactor: wip
1 parent d286494 commit 6076e90

File tree

1 file changed

+5
-4
lines changed
  • packages/plugin-bundle-stats/src/lib/runner/audits/details

1 file changed

+5
-4
lines changed

packages/plugin-bundle-stats/src/lib/runner/audits/details/path-utils.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ export function splitPathSegments(path: string): string[] {
1414
*/
1515
export function normalizePathForMatching(path: string): string {
1616
// Remove all instances of ../, applying repeatedly to catch overlapping or regenerated cases
17+
let normalizedPath = path;
1718
let prev;
1819
do {
19-
prev = path;
20-
path = path.replace(/\.\.\//g, '');
21-
} while (path !== prev);
22-
return path.replace(/^\/+/, '');
20+
prev = normalizedPath;
21+
normalizedPath = normalizedPath.replace(/\.\.\//g, '');
22+
} while (normalizedPath !== prev);
23+
return normalizedPath.replace(/^\/+/, '');
2324
}
2425

2526
/**

0 commit comments

Comments
 (0)