Skip to content

module: incorrect relative path for dynamic import in REPL #30868

@guybedford

Description

@guybedford
  • Version: 13.2.0
  • Platform: Windows
  • Subsystem: modules

With a file system containing project/module.mjs, and running the Node.js REPL from within the project folder:

node
> import('./module.mjs')

gives the error -

UnhandledPromiseRejectionWarning: Error: Cannot find module C:\...\project\module.mjs imported from C:\...\project

The issue is that it is looking for the file in the directory below.

This can be resolved by treating the cwd parent path as having a trailing slash in the REPL resolver.

Metadata

Metadata

Assignees

No one assigned

    Labels

    esmIssues and PRs related to the ECMAScript Modules implementation.good first issueIssues that are suitable for first-time contributors.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions