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

@ -120,7 +120,7 @@ export function processLocalImports(
sources: Record<string, string>,
specifiers: Array<[string, string]>,
referrer?: string,
checkJs = false
processJsImports = false
): string[] {
if (!specifiers.length) {
return [];
@ -145,9 +145,9 @@ export function processLocalImports(
if (!sourceFile.processed) {
processLocalImports(
sources,
sourceFile.imports(checkJs),
sourceFile.imports(processJsImports),
sourceFile.url,
checkJs
processJsImports
);
}
}
@ -163,7 +163,7 @@ export function processLocalImports(
export async function processImports(
specifiers: Array<[string, string]>,
referrer?: string,
checkJs = false
processJsImports = false
): Promise<string[]> {
if (!specifiers.length) {
return [];
@ -179,9 +179,9 @@ export async function processImports(
sourceFile.cache(specifiers[i][0], referrer);
if (!sourceFile.processed) {
await processImports(
sourceFile.imports(checkJs),
sourceFile.imports(processJsImports),
sourceFile.url,
checkJs
processJsImports
);
}
}