From 83d902a7803adb0c69fe2c98e692a50dae446db9 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Tue, 3 Mar 2020 08:18:27 +1100 Subject: Fix JavaScript dependencies in bundles. (#4215) Fixes #4602 We turned off `allowJs` by default, to keep the compiler from grabbing a bunch of files that it wouldn't actually do anything useful with. On the other hand, this caused problems with bundles, where the compiler needs to gather all the dependencies, including JavaScript ones. This fixes this so that when we are bundling, we analyse JavaScript imports in the compiler. --- cli/js/compiler_api_test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cli/js/compiler_api_test.ts') diff --git a/cli/js/compiler_api_test.ts b/cli/js/compiler_api_test.ts index 64ba70afb..fcca0a22b 100644 --- a/cli/js/compiler_api_test.ts +++ b/cli/js/compiler_api_test.ts @@ -135,6 +135,15 @@ test(async function bundleApiConfig() { assert(!actual.includes(`random`)); }); +test(async function bundleApiJsModules() { + const [diagnostics, actual] = await bundle("/foo.js", { + "/foo.js": `export * from "./bar.js";\n`, + "/bar.js": `export const bar = "bar";\n` + }); + assert(diagnostics == null); + assert(actual.includes(`System.register("bar",`)); +}); + test(async function diagnosticsTest() { const [diagnostics] = await compile("/foo.ts", { "/foo.ts": `document.getElementById("foo");` -- cgit v1.2.3