#26693·deno

Deno fails when a package in a monorepo uses a `./*` export

Author: michael-aldridge-pozloCreated Nov 2, 2024Updated Sep 14, 2026
Labelspublish

Deno version

$ deno --version
deno 2.0.4 (stable, release, x86_64-unknown-linux-gnu)
v8 12.9.202.13-rusty
typescript 5.6.2

To demonstrate the issue I created the following mono-repo

$ tree
.
├── a
│   ├── deno.json
│   └── src
│       └── index.ts
├── deno.json
└── index.ts

The root deno.json just specifies the a package

$ cat deno.json 
{
    "workspace": ["./a"]
}

The a package has a single export

$ cat a/src/index.ts 
export const foo = 42;

and a minimal deno.json

$ cat a/deno.json 
{
    "name": "@github-issue-example/a",
    "exports": {
        ".": "./src/index.ts",
        "./*": "./src/*"
    }
}

finally, the root module index.ts files contains a single export

$ cat index.ts 
import { foo } from "@github-issue-example/a/index.ts";

This sort of set up worked fine with node but deno is not happy about this import

$ deno run index.ts 
error: Relative import path "@github-issue-example/a/index.ts" not prefixed with / or ./ or ../ and not in import map from "file:///home/michael/github-issue-demos/deno-monorepo/index.ts"
    at file:///home/michael/github-issue-demos/deno-monorepo/index.ts:1:21

If I change the export map in a/deno.json to explicitly list index everything works fine, i.e.

$ cat a/deno.json 
{
    "name": "@github-issue-example/a",
    "exports": {
        ".": "./src/index.ts",
        "./index.ts": "./src/index.ts"
    }
}

This would seem to be a bug to me but it might be a feature request, I can't quite tell from the documentation. Any advise or help greatly appreciated. Thanks.


This issues looks similar to https://github.com/denoland/deno/issues/20513 but I thought it different enough to warrant a separate issue.