adoublef
adoublef•10mo ago

workspace import

I have a vsc root-level settings.json file
{
"deno.enable": true,
"deno.enablePaths": [
"./"
],
}
{
"deno.enable": true,
"deno.enablePaths": [
"./"
],
}
I want to be able to use the following inside of the deno projects inside the directory
{
"imports": {
"$std/":"https://deno.land/std@0.217.0/"
}
}
{
"imports": {
"$std/":"https://deno.land/std@0.217.0/"
}
}
but I am getting the following Relative import path "$std/assert/mod.ts" not prefixed with / or ./ or ../deno(import-prefix-missing)
3 Replies
adoublef
adoublefOP•10mo ago
from this issue it seems you need to define one of the configs but can I yet, define many configs?
GitHub
imports not used when using multi-root workspaces for website devel...
VSCode Deno plugin does not read deno.json when used in multi-root workspace configuration. www/deno.json has imports path for Effection in other dependencies which Deno LSP does not know how to re...
Deno AI Helper
Deno AI Helper•10mo ago
It looks like you're trying to use import maps in your Deno project within Visual Studio Code. Import maps allow you to create aliases for module paths, which can simplify imports in your project. From the error message you're seeing, it seems that the import map configuration is not being recognized by Deno. This can happen if the import map is not properly configured or if Deno is not aware of the import map's location. To resolve this issue, you should ensure that your import map is correctly defined in a deno.json or deno.jsonc configuration file at the root of your workspace. According to the documentation, Deno will automatically detect and apply an import map specified in these configuration files. Here's what you need to do: 1. Create a deno.json or deno.jsonc file at the root of your workspace if it doesn't already exist. 2. Add your import map configuration to this file. Based on your example, it should look like this:
{
"imports": {
"$std/": "https://deno.land/std@0.217.0/"
}
}
{
"imports": {
"$std/": "https://deno.land/std@0.217.0/"
}
}
3. Ensure that the Deno extension for Visual Studio Code is configured to use this import map. You can do this by setting the deno.importMap setting in your .vscode/settings.json file to point to your import map file. For example:
{
"deno.enable": true,
"deno.importMap": "./deno.json"
}
{
"deno.enable": true,
"deno.importMap": "./deno.json"
}
Make sure that the path to the deno.json file is correct and relative to the root of your workspace. After making these changes, Deno should recognize your import map configuration, and you should no longer see the Relative import path "$std/assert/mod.ts" not prefixed with / or ./ or ../deno(import-prefix-missing) error. If you continue to experience issues, you may want to restart Visual Studio Code to ensure that the settings
Deno AI Helper
Deno AI Helper•10mo ago
are reloaded, and check that the Deno extension is up to date. 🦕