Skip to content

Why is it not possible to require() ES modules from CommonJS modules? #2293

@kimamula

Description

@kimamula
  • Node.js Version: v13
  • OS: any
  • Scope (install, code, runtime, meta, other?): other
  • Module (and version) (if relevant): ECMAScript modules

Using dual package which exports both CommonJS and ES modules can be problematic as described.

If CommonJS modules could require() ES modules, both CommonJS modules and ES modules could always use the same ES modules in dual package and the problem should not occur.
I would like to know the reason why this is not possible.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions