From e1cc3fa1811e30f2760960663b069f38d52f76e8 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 4 Sep 2024 10:36:15 +0200 Subject: [PATCH] tsb should handle `.js` suffix (#227544) fixes https://github.com/microsoft/vscode/issues/227540 --- build/lib/tsb/builder.js | 5 ++++- build/lib/tsb/builder.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/build/lib/tsb/builder.js b/build/lib/tsb/builder.js index fc74bfa8acc63..e097b91a3ea0a 100644 --- a/build/lib/tsb/builder.js +++ b/build/lib/tsb/builder.js @@ -550,7 +550,10 @@ class LanguageServiceHost { let found = false; while (!found && dirname.indexOf(stopDirname) === 0) { dirname = path.dirname(dirname); - const resolvedPath = path.resolve(dirname, ref.fileName); + let resolvedPath = path.resolve(dirname, ref.fileName); + if (resolvedPath.endsWith('.js')) { + resolvedPath = resolvedPath.slice(0, -3); + } const normalizedPath = normalize(resolvedPath); if (this.getScriptSnapshot(normalizedPath + '.ts')) { this._dependencies.inertEdge(filename, normalizedPath + '.ts'); diff --git a/build/lib/tsb/builder.ts b/build/lib/tsb/builder.ts index 9fc476ae7020b..8aa277a8a822f 100644 --- a/build/lib/tsb/builder.ts +++ b/build/lib/tsb/builder.ts @@ -660,7 +660,10 @@ class LanguageServiceHost implements ts.LanguageServiceHost { while (!found && dirname.indexOf(stopDirname) === 0) { dirname = path.dirname(dirname); - const resolvedPath = path.resolve(dirname, ref.fileName); + let resolvedPath = path.resolve(dirname, ref.fileName); + if (resolvedPath.endsWith('.js')) { + resolvedPath = resolvedPath.slice(0, -3); + } const normalizedPath = normalize(resolvedPath); if (this.getScriptSnapshot(normalizedPath + '.ts')) {