Skip to content

ESM re-exports from CJS module not included in exports #61989

@dsherret

Description

@dsherret

Version

node-v

Platform

Microsoft Windows NT 10.0.26100.0 x64

Subsystem

No response

What steps will reproduce the bug?

// main.mjs
import * as mod from "./mod.js";
console.log(mod);

// mod.js
module.exports = {
  ...require("./other.js")
};

// other.js
export function test() {}
> node main.mjs  
[Module: null prototype] {
  default: { test: [Function: test] },
  'module.exports': { test: [Function: test] }
}
> deno -A --unstable-detect-cjs main.mjs
[Module: null prototype] {
  default: { test: [Function: test] },
  "module.exports": { test: [Function: test] },
  test: [Function: test]
}

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

Every time.

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

It should detect the "test" export from the ES module.

What do you see instead?

It's missing.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    loadersIssues and PRs related to ES module loaders

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions