Skip to content

regression in 21.4.0 when using esm package #51081

Description

@jeremymeng

Version

v21.4.0

Platform

Linux codespaces-8a914d 6.2.0-1016-azure #16~22.04.1-Ubuntu SMP Tue Oct 10 17:11:51 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

  1. npm init -y
  2. npm add esm
  3. create a file test.js with the following content
import { writeFileSync } from "fs";
console.log("hello");
  1. node -r esm test.js

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

always

What is the expected behavior? Why is that the expected behavior?

same as in v21.3.0

/workspaces/working/mocha/esm-test $ nvm use v21.3.0
Now using node v21.3.0 (npm v10.2.4)
/workspaces/working/mocha/esm-test $ node -r esm test.js
hello

What do you see instead?

content of esm.js is dumped to console for a TypeError

TypeError: Function.prototype.apply was called on undefined, which is a undefined and not a function
    at node:internal/main/run_main_module:28:49

Node.js v21.4.0

Additional information

No response

Activity

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

    fsIssues and PRs related to file-system APIs and the fs module.wontfixIssues that will not be fixed.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions