summaryrefslogtreecommitdiff
path: root/cli/js/compiler.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-02-20 14:58:05 +1100
committerGitHub <noreply@github.com>2020-02-19 22:58:05 -0500
commit6431622a6debc0443f9269fe0157571ec54701c0 (patch)
tree8657fe0eaeb492283f369c0813d46880683e5efb /cli/js/compiler.ts
parent0e579ee9dce917c1b783cea5506315f78b1e0a00 (diff)
fix: mis-detecting imports on JavaScript when there is no checkJs (#4040)
This PR fixes an issue where we recursively analysed imports on plain JS files in the compiler irrespective of "checkJs" being true. This caused problems where when analysing the imports of those files, we would mistake some import like structures (AMD/CommonJS) as dependencies and try to resolve the "modules" even though the compiler would not actually look at those files.
Diffstat (limited to 'cli/js/compiler.ts')
-rw-r--r--cli/js/compiler.ts16
1 files changed, 9 insertions, 7 deletions
diff --git a/cli/js/compiler.ts b/cli/js/compiler.ts
index 4ca2887c6..3db0e2f52 100644
--- a/cli/js/compiler.ts
+++ b/cli/js/compiler.ts
@@ -105,13 +105,6 @@ async function tsCompilerOnMessage({
type: CompilerRequestType[request.type]
});
- // This will recursively analyse all the code for other imports,
- // requesting those from the privileged side, populating the in memory
- // cache which will be used by the host, before resolving.
- const resolvedRootModules = await processImports(
- rootNames.map(rootName => [rootName, rootName])
- );
-
// When a programme is emitted, TypeScript will call `writeFile` with
// each file that needs to be emitted. The Deno compiler host delegates
// this, to make it easier to perform the right actions, which vary
@@ -141,6 +134,15 @@ async function tsCompilerOnMessage({
diagnostics = processConfigureResponse(configResult, configPath);
}
+ // This will recursively analyse all the code for other imports,
+ // requesting those from the privileged side, populating the in memory
+ // cache which will be used by the host, before resolving.
+ const resolvedRootModules = await processImports(
+ rootNames.map(rootName => [rootName, rootName]),
+ undefined,
+ host.getCompilationSettings().checkJs
+ );
+
let emitSkipped = true;
// if there was a configuration and no diagnostics with it, we will continue
// to generate the program and possibly emit it.