Skip to content

dynamic import can't be used in the REPL #19570

Description

@targos
$ ./node --experimental-modules
> (node:14483) ExperimentalWarning: The ESM module loader is experimental.
> import('fs').then(console.log, console.log)
Promise {
  <pending>,
  domain:
   Domain {
     domain: null,
     _events:
      { removeListener: [Function: updateExceptionCapture],
        newListener: [Function: updateExceptionCapture],
        error: [Function: debugDomainError] },
     _eventsCount: 3,
     _maxListeners: undefined,
     members: [] } }
> { TypeError [ERR_INVALID_URL]: Invalid URL: repl
    at onParseError (internal/url.js:226:17)
    at parse (internal/url.js:235:3)
    at new URL (internal/url.js:318:5)
    at normalizeReferrerURL (internal/process/esm_loader.js:18:10)
    at setImportModuleDynamicallyCallback (internal/process/esm_loader.js:51:37)
    at process._tickCallback (internal/process/next_tick.js:114:7) input: 'repl' }

Metadata

Metadata

Assignees

Labels

esmIssues and PRs related to the ECMAScript Modules implementation.replIssues and PRs related to the REPL subsystem.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions