Using "imports" in deno.json doesn't work in VS.code
* deno 1.38.3
* vs.code 1.84.2
* denoland.vscode-deno 3.28.0
I got rid of my import map and moved the
"imports"
directly into deno.json
, as supported since 1.30.0
.
Deno works fine, but the VS.code extension is now broken and complains about the missing import map on each of my local import { … } from "@/foo/bar.ts"
.8 Replies
It's probably because your
deno.json
is in a subdirectory (not the workspace root). Support for that is coming soon but you can work around it by pointing to the file in the "deno.config"
setting.it's not, it's at the root of the workspace.
I reverted my changed and brought back the import map for the time being.
hi, i can't reproduce, could you share your project sturcture, config and error messages?
![No description](https://cdn.answeroverflow.com/1177903129061244998/image.png)
![No description](https://cdn.answeroverflow.com/1177903129656819743/image.png)
Project structure is basically the same as you
Works
![No description](https://cdn.answeroverflow.com/1177904962064371795/Screenshot_2023-11-25_at_18.32.53.png)
![No description](https://cdn.answeroverflow.com/1177904962425073784/Screenshot_2023-11-25_at_18.33.01.png)
Doesn't work
![No description](https://cdn.answeroverflow.com/1177905027466141747/Screenshot_2023-11-25_at_18.31.56.png)
![No description](https://cdn.answeroverflow.com/1177905027709403217/Screenshot_2023-11-25_at_18.32.11.png)
![No description](https://cdn.answeroverflow.com/1177905028061736960/Screenshot_2023-11-25_at_18.32.24.png)
i suspect deno has higher precedence for
import_map.json
, and since it's empty, it errors.
try removing the empty import_map.json
well, deno works perfectly fine. the only problem is the vscode extension.
ah, removing the empty import map (that's not referenced anywhere anymore) fixes the extension!
thanks!
ah, i see what happened…
in the workspace's
settings.json
, I had "deno.importMap": "import_map.json"
🤦