We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0c797a5 commit aaaf09fCopy full SHA for aaaf09f
src/compiler/path.ts
@@ -452,9 +452,12 @@ namespace ts {
452
* Normalize path separators, converting `\` into `/`.
453
*/
454
export function normalizeSlashes(path: string): string {
455
- return path.indexOf(altDirectorySeparator) === -1
456
- ? path
457
- : path.replace(backslashRegExp, directorySeparator);
+ const index = path.indexOf("\\");
+ if (index === -1) {
+ return path;
458
+ }
459
+ backslashRegExp.lastIndex = index; // prime regex with known position
460
+ return path.replace(backslashRegExp, directorySeparator);
461
}
462
463
/**
0 commit comments