Issue
I have this TypeScript complaint in my editor for a Deno module.
Relative import path "$fresh/dev.ts" not prefixed with / or ./ or ../
There is an import_map.json
with this content.
{
"imports": {
"$fresh/": "https://deno.land/x/fresh@1.1.2/",
"preact": "https://esm.sh/preact@10.11.0",
"preact/": "https://esm.sh/preact@10.11.0/",
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@5.2.4",
"@preact/signals": "https://esm.sh/*@preact/signals@1.0.3",
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.0.1",
"twind": "https://esm.sh/twind@0.16.17",
"twind/": "https://esm.sh/twind@0.16.17/"
}
}
The VSCode TypeScript language server has crashed a couple times, too. I assume it's related.
This code was created by the Deno Fresh project template, and I've not touched it. My understanding is that TypeScript should be cool with these imports, due to the map.
Unless it's not finding the map. Perhaps the spec changed and Deno is out of date. Hmm.
What do you reckon is causing the error?
Looks like GitHub issue: "Support import maps and bare import specifiers" isn't done yet for TS:
Perhaps, I should ignore it and not go in these files?
Solution
Fixed with a setting in my workspace:
"deno.importMap": "./import_map.json"
Answered By - Luke Puplett
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.