jcayzac
jcayzac8mo ago

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
nayeemrmn
nayeemrmn8mo ago
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.
jcayzac
jcayzac8mo ago
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.
scarf
scarf8mo ago
hi, i can't reproduce, could you share your project sturcture, config and error messages?
No description
No description
jcayzac
jcayzac8mo ago
Project structure is basically the same as you
jcayzac
jcayzac8mo ago
Works
No description
No description
jcayzac
jcayzac8mo ago
Doesn't work
No description
No description
No description
scarf
scarf8mo ago
i suspect deno has higher precedence for import_map.json, and since it's empty, it errors. try removing the empty import_map.json
jcayzac
jcayzac8mo ago
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" 🤦