Fix path mapping call on web (#221859)

Fixes #221299

Seems like a TS bug that realpath is called here. This is a workaround for that
This commit is contained in:
Matt Bierner
2024-07-16 16:30:05 -07:00
committed by GitHub
parent 4bc02fc78f
commit f4dabd7898

View File

@@ -338,6 +338,11 @@ function createServerHost(
// For module resolution only. `node_modules` is also automatically mapped
// as if all node_modules-like paths are symlinked.
function realpath(path: string): string {
if (path.startsWith('/^/')) {
// In memory file. No mapping needed
return path;
}
const isNm = looksLikeNodeModules(path) && !path.startsWith('/vscode-global-typings/');
// skip paths without .. or ./ or /. And things that look like node_modules
if (!isNm && !path.match(/\.\.|\/\.|\.\//)) {