From 658ec2aaf9c7e0d0b4ded4e97a3d89dc2fa25806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 25 Nov 2019 15:33:23 +0100 Subject: better error message for missing module (#3402) --- cli/js/compiler.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cli/js/compiler.ts') diff --git a/cli/js/compiler.ts b/cli/js/compiler.ts index 4ad4ae8a4..35e332582 100644 --- a/cli/js/compiler.ts +++ b/cli/js/compiler.ts @@ -171,7 +171,8 @@ class SourceFile { /** Cache the source file to be able to be retrieved by `moduleSpecifier` and * `containingFile`. */ - cache(moduleSpecifier: string, containingFile: string): void { + cache(moduleSpecifier: string, containingFile?: string): void { + containingFile = containingFile || ""; let innerCache = SourceFile._specifierCache.get(containingFile); if (!innerCache) { innerCache = new Map(); @@ -269,7 +270,7 @@ function fetchAsset(name: string): string { /** Ops to Rust to resolve and fetch modules meta data. */ function fetchSourceFiles( specifiers: string[], - referrer: string + referrer?: string ): Promise { util.log("compiler::fetchSourceFiles", { specifiers, referrer }); return sendAsync(dispatch.OP_FETCH_SOURCE_FILES, { @@ -286,7 +287,7 @@ function fetchSourceFiles( * that should be actually resolved. */ async function processImports( specifiers: Array<[string, string]>, - referrer = "" + referrer?: string ): Promise { if (!specifiers.length) { return []; -- cgit v1.2.3