Skip to content

module resolution has wrong starting point #27750

Closed
@lukeed

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.

Metadata

Assignees

No one assigned

    Labels

    needs infoneeds further information to be properly triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions