I started a project of developmeent of an portal web project with Deno, but a lot of my files have the same problem : Relative import path “$fresh/server.ts” not prefixed with / or ./ or ../
I already search on stack overflow but the answers don’t work.
For an example, my main.ts of the fresh project :
/// <reference no-default-lib="true" />
/// <reference lib="dom" />
/// <reference lib="dom.iterable" />
/// <reference lib="dom.asynciterable" />
/// <reference lib="deno.ns" />
import "$std/dotenv/load.ts";
import { start } from "$fresh/server.ts"; //Relative import path "$std/dotenv/load.ts" not prefixed with / or ./ or ../
import manifest from "./fresh.gen.ts"; //Relative import path "$fresh/server.ts" not prefixed with / or ./ or ../
import config from "./fresh.config.ts";
await start(manifest, config);
I’m not very comfortable with this type of development, so I don’t understand the dependencies. I check my imports in the deno.json file :
"imports": {
"deno.importMap": "../import_map.json",
"$fresh/": "https://deno.land/x/[email protected]/",
...
and my import_map.json :
{
"imports": {
"$fresh/": "https://deno.land/x/[email protected]/",
"preact": "https://esm.sh/[email protected]",
"preact/hooks": "https://esm.sh/[email protected]/hooks",
"preact/jsx-runtime": "https://esm.sh/[email protected]/jsx-runtime"
}
}
I’m using VSCode with the Deno extension.
I tried to add "deno.importMap": "./import_map.json"
to my imports like I see on a other topic, but nothing change.
My API and interface still working, my whole project is functional but in VSCode I have many problems due to relative import path
Thank you in advance for your answers and do not hesitate to ask me for more information