#6369·rollup

Feature Request: return the `module.exports` export when `require(esm)`

Author: chirsz-everCreated Apr 30, 2026Updated Apr 30, 2026
Labelst³ ✨ enhancementt⁸ ⋅ triage

Feature Use Case

This makes Rollup compatible with Node.js.

This can help authors convert libraries to ESM-Only, which currently provides dual ESM/CJS modules and depends on using module.exports = ... in CommonJS.

Underscore related issues:

Feature Proposal

This is the mechanism of require(esm) implemented in Node.js^1: if the imported module has a named export with the string name "module.exports", then the value corresponding to that export is returned.

In Rollup, the equivalent would be: if an ES Module is imported by require and it has a named export with the string name "module.exports", then the value corresponding to that export should be returned.

Currently, among various bundlers, I only found rolldown to have implemented this feature^2.