Skip to content

Compatibillity with deno's remote import map #936

Closed
denoland/deno
#20651
@lo0k0502

Description

Describe the bug

Remote import map file is not applied to local workspace

To Reproduce

Remote

  1. Create a directory contains two files: import_map.json and mod.ts
  2. Add content
// import_map.json
{
    "imports": {
        "@test/": "./"
    }
}
// mod.ts
export const hello = () => console.log('I\'m the remote module!');
  1. I'm using the Live Server VSCode Extension here to simplify the reproduction, but I have tried a vm with Nginx as the remote and results the same thing.

Local

  1. Create a directory with some basic project setup: .vscode/settings.json, main.ts, and deno.jsonc
// .vscode/settings.json
{
  "deno.enable": true,
  "deno.importMap": "http://<remote_ip>:5500/import_map.json"
}
// main.ts
import { hello } from "@test/mod.ts";

hello();
// deno.jsonc
{
  "tasks": {
    "dev": "deno run main.ts"
  },
  "importMap": "http://<remote_ip>:5500/import_map.json"
}
  1. After I saved either .vscode/settings.json or deno.jsonc, VSCode pops up an warning Failed to load the import map at: file:///$HOME/Desktop/deno-test/http:/<remote_ip>:5500/import_map.json. No such file or directory (os error 2)
    The workspace can't recognize what @test/ is referred to and thus don't have any suggestions when I typed @test/ (See the screenshot below), but when I use deno task dev it's working totally fine.
    After I do deno task dev, the remote mod.ts is cache correctly since when I typed the original url http://<remote_ip>:5500/mod.ts VSCode totally recognize what it is, but @test/mod.ts is still throwing error.

Expected behavior

VSCode should recognize the remote import_map.json without an error or warning, and apply suggestions if some of the remote files is already cached.
Maybe this can be done with caching the remote import_map.json?

Screenshots

截圖 2023-09-23 下午6 16 16

Versions

VSCode: 1.82.2
Deno: 1.37.0
Extension: 3.32.1

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions