You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ESM re-exports from CJS module not included in exports #61989
To clarify, the request is for the import * CJS lexer to detect and parse ...require(esm) re-exports?
Yes. It currently doesn't handle it.
Merve says if the file is ESM, so it would be possible to just run a pass on the file to get the ESM exports. That said, it would be even better if merve returned this information because then it would still be a single lexer pass.
Are there examples of this in the wild?
I don't have a specific example, but it's inevitable people will run into this during the transition to ESM (ex. one package re-exporting another package) and making this work properly will make that a smoother transition.
This issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
This issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
Activity
Renegade334 commentedon Feb 25, 2026
To clarify, the request is for the
import *CJS lexer to detect and parse...require(esm)re-exports? Are there examples of this in the wild?dsherret commentedon Feb 25, 2026
Yes. It currently doesn't handle it.
Merve says if the file is ESM, so it would be possible to just run a pass on the file to get the ESM exports. That said, it would be even better if merve returned this information because then it would still be a single lexer pass.
I don't have a specific example, but it's inevitable people will run into this during the transition to ESM (ex. one package re-exporting another package) and making this work properly will make that a smoother transition.
alexsch01 commentedon Feb 26, 2026
I also notice this behavior with nodejs
Output, test2 and foo are missing
in both my example and the OP's example
changing
to
makes it less of an issue in nodejs
dsherret commentedon Feb 26, 2026
@alexsch01 that's a different issue with some property assignments in object literals not being recognized. nodejs/merve#27
If I change
other.jsin the original issue from ESM (export function test() {}) to CJS (module.exports.test = 5;) it will work.github-actions commentedon Jul 20, 2026
This issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
dsherret commentedon Jul 20, 2026
Stale bots are one of the worst things. I will now participate in the ceremony of doing a comment to undo the stale label.
github-actions commentedon Oct 20, 2026
This issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
alexsch01 commentedon Oct 20, 2026
Keep open