summaryrefslogtreecommitdiff
path: root/cli/js/compiler.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-11-25 15:33:23 +0100
committerRy Dahl <ry@tinyclouds.org>2019-11-25 09:33:23 -0500
commit658ec2aaf9c7e0d0b4ded4e97a3d89dc2fa25806 (patch)
tree1996038f0f62ed207fe5a1adb518a299eafbe0c8 /cli/js/compiler.ts
parentbca23e64339f9b41272e4a01e4c1a86602e5c1e4 (diff)
better error message for missing module (#3402)
Diffstat (limited to 'cli/js/compiler.ts')
-rw-r--r--cli/js/compiler.ts7
1 files changed, 4 insertions, 3 deletions
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<SourceFileJson[]> {
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<SourceFileJson[]> {
if (!specifiers.length) {
return [];