Closed
Description
Version: Deno 2.1.6
When using deno run <initial>
Deno is always resolving files from the initial
starting point instead of each resolved file's current location.
Example
/// /tmp/foobar.ts
let m = await import('/path/to/projects/app/file.ts');
/// /path/to/projects/app/node_modules/library
//-> exists, as per normal
/// /path/to/projects/app/file.ts
import * as lib from 'library';
export const version = lib.version;
When you run deno run -A /tmp/foobar.ts
you will get:
[ERROR] Relative import path "library" not prefixed with / or ./ or ../
hint: If you want to use a JSR or npm package, try running `deno add jsr:library` or `deno add npm:library`
at file:////path/to/projects/app/file.ts1:24
However, no error if you deno run -A /path/to/projects/app/file.ts
It sucks, but module resolution needs to stem from every file's current location.