parjs icon indicating copy to clipboard operation
parjs copied to clipboard

Exporting `then` causes issues with ES modules

Open dmaretskyi opened this issue 11 months ago • 2 comments

MDN's advice is not to export then from modules: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import#module_namespace_object

This is effectively causing vitest to hang indefinitelly: https://github.com/vitest-dev/vitest/issues/7174

dmaretskyi avatar Jan 17 '25 05:01 dmaretskyi

Awesome, looks like you found a possible cause.

@GregRos this presents a curious problem - the then function (definition here) cannot be exported with its own name. Maybe it should be renamed?

mikavilpas avatar Jan 17 '25 05:01 mikavilpas

I made a temporary fork as a workaround: https://www.npmjs.com/package/parjs-then It uses andThen for then. I renamed related combinators (thenq and qthen) as well for IMO, consistency. butThen is for qthen, and followedBy is for thenq.

Ailrun avatar Sep 19 '25 21:09 Ailrun