denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.99k stars 5.23k forks source link

Inconsistencies of unrelated but nested workspaces #25309

Open albnnc opened 2 weeks ago

albnnc commented 2 weeks ago

Version: Deno 1.46.2

Repro repo: https://github.com/albnnc/deno-repro-20240830

Possibly related: https://github.com/denoland/deno/issues/25226

Should the following cases work, or do I have wrong understanding of workspaces in Deno?

Possibly wrong warning of improper "patch" usage

cd internal
deno run ./mod.ts

image

Workspace "internal" is nested in terms of folder structure only (it's not referenced in "workspace" field of outer deno.jsonc), but it looks like Deno thinks that internal/deno.jsonc is a part of outer workspace, which is wrong. Looks like "warning" message is wrong.

Module resolution differs between implicit and explicit Deno config cases

cd internal
deno info ./mod.ts
deno info ./mod.ts --config ./deno.jsonc

image

As far as I can understand, explicit reference of deno.jsonc which is in CWD shouldn't change anything. This behaviour breaks esbuild_deno_loader in some cases.

dsherret commented 2 weeks ago

Workspace "internal" is nested in terms of folder structure only (it's not referenced in "workspace" field of outer deno.jsonc), but it looks like Deno thinks that internal/deno.jsonc is a part of outer workspace, which is wrong. Looks like "warning" message is wrong.

I think the error message could maybe be improved here, but basically a patch that leads to another patch is not supported at the moment. You need to specify everything in the first workspace root deno.json file.

As far as I can understand, explicit reference of deno.jsonc which is in CWD shouldn't change anything.

Yeah, that seems like a bug