BloxsB
Denoβ€’2y agoβ€’
3 replies
Bloxs

Deno LSP doesn't recognize workspaces as imports

For some reason the vscode plugin for deno says this code is invalid even though it runs perfectly fine via the cli.
mod.ts:
import { add } from "@mypackage/test";

console.log(add(1, 2)); // 3

deno.jsonc:
{
    "name": "@mypackage/root",
    "version": "0.0.1",
    "workspaces": [
        "./test"
    ]
}


./test/mod.ts
export const add = (a: number, b: number) => a + b;


./test/deno.jsonc
{
    "name": "@mypackage/test",
    "version": "0.0.1",
    "exports": "./mod.ts"
}


When I run mod.ts via the cli I get 3 which is expected but the vscode lsp says Relative import path "@mypackage/test" not prefixed with / or ./ or ../
Was this page helpful?