deno icon indicating copy to clipboard operation
deno copied to clipboard

Cannot use jsr.json as workspace member outside deno publish

Open NfNitLoop opened this issue 1 year ago • 3 comments

> deno --version
deno 1.45.2 (release, x86_64-pc-windows-msvc)
v8 12.7.224.12
typescript 5.5.2

I found a case where no name seems to be created for a local member.

I was trying to add a dependency as a workspace member to be able to modify/test it locally, a described here.

But, neither of its possible names were made available in the workspace.

Reproduction

mkdir example
cd example
git clone [email protected]:nbd-wtf/nostr-tools.git
# Note, current commit: 54e352d8e2db84070eb12854d8e4705f9fa3d698

Note that the library has a jsr.json with a name of "@nostr/tools", and a package.json with a name of "nostr-tools". I'd expect one of these names to be available when we add this as a workspace member.

// deno.jsonc
{
    "workspace": [ "nostr-tools" ]
}
// main.ts

// Neither of these works:

import { Relay } from "@nostr/tools"
import { Relay } from "nostr-tools"

Results:

error: Relative import path "nostr-tools" not prefixed with / or ./ or ../
    at file:///C:/Users/codyc/code/example/main.ts:2:23

or:

error: Relative import path "@nostr/tools" not prefixed with / or ./ or ../
    at file:///C:/Users/codyc/code/example/main.ts:1:23

I didn't have this problem using this pattern with this library, though: https://github.com/lucacasonato/esbuild_deno_loader

NfNitLoop avatar Jul 16 '24 06:07 NfNitLoop