Skip to content

Loader is not loaded when using "-e ..." #33303

Description

@giltayar
  • Version: 14.2.0
  • Platform: MacOS
  • Subsystem: ESM

What steps will reproduce the bug?

  1. Create an empty loader.mjs:
console.log('loader loaded')
  1. Create a file foo.js to be executed:
console.log('foo loaded')
  1. Now run foo.js with the loader:
node --loader=./empty.mjs foo.js

As expected, it will print both loader loaded and foo loaded

  1. Now run foo.js, but using -e:
node --loader=./empty.mjs -e 'require("./foo.js")'

Only foo loaded is run, whereas I would expect loaded loaded to also be printed.

  1. node --loader=./empty.mjs -e 'import("./foo.js")'

This also prints only foo loaded, which means that it's not lazy loading of the loader.

How often does it reproduce? Is there a required condition?

Consistently

What is the expected behavior?

The loader should be loaded even when using -e.

What do you see instead?

Loader is not loaded when using -e.

Activity

  1. changed the title [-]Loader is not loaded when using `-e ...`[/-] [+]Loader is not loaded when using "-e ..."[/+] on May 8, 2020
  2. DerekNonGeneric commented on Jun 17, 2020

    @DerekNonGeneric
    Contributor

    Linking #33435 due to the similarity.

  3. added
    esmIssues and PRs related to the ECMAScript Modules implementation.
    on Dec 27, 2020
  4. avivkeller commented on Jul 2, 2024

    @avivkeller
    Member

    I'm not able to reproduce on the latest version on Node.js. AFAICT loaders are now correctly loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    esmIssues and PRs related to the ECMAScript Modules implementation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions