Skip to content

Commit

Permalink
fix(import_map): pass URL to readTextFile
Browse files Browse the repository at this point in the history
  • Loading branch information
hasundue committed Oct 23, 2023
1 parent 63fafe8 commit 7c1509f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/import_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ const isImportMapReferrer = is.ObjectOf({
// This implementation is ridiculously inefficient, but we prefer not to reimplement the whole
// import_map module. Maybe we should rathre patch rust code of the import_map module.
async function readFromJson(specifier: URI<"file">): Promise<Maybe<ImportMap>> {
const data = await Deno.readTextFile(URI.relative(specifier));
if (data.length === 0) return;
console.debug(specifier);
const data = await Deno.readTextFile(new URL(specifier));
if (data.length === 0) {
return;
}
const json = parseJsonc(data);
if (isImportMapReferrer(json)) {
// The json seems to be deno.json or deno.jsonc referencing an import map.
Expand Down

0 comments on commit 7c1509f

Please sign in to comment.