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.
This commit is contained in:
Kitson Kelly 2020-03-03 08:18:27 +11:00 committed by GitHub
parent a3c3a56ff7
commit 83d902a780
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 84 additions and 25 deletions

View file

@ -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");`