promise-pool icon indicating copy to clipboard operation
promise-pool copied to clipboard

Plans for dual build CJS, ESM

Open woss opened this issue 1 year ago • 6 comments

Hi,

Is there a plan to support both CJS and ESM?

Having both, CJS and ESM, would be great when one project wants to switch to pure ESM without looking for an alternative like p-limit.

I don't mind sending the PR for this.

woss avatar Dec 02 '24 15:12 woss

@woss Hey Daniel, yes: supporting CJS and ESM is planned. I would appreciate your pull request to support this šŸ™‚ thank you!

marcuspoehls avatar Dec 03 '24 04:12 marcuspoehls

Perfect, hopefully soon i'll send the PR :) it's December after all, time for mulled wine and sauerkraut :)

woss avatar Dec 04 '24 09:12 woss

@woss Thank you!

marcuspoehls avatar Dec 04 '24 13:12 marcuspoehls

We have a need for pure ESM, @woss I can take this on if you haven't started.

@marcuspoehls any opinions on tooling, tsup, tsdown, etc?

jimmy-guzman avatar May 23 '25 19:05 jimmy-guzman

Hey @jimmy-guzman, feel free to start implementing this. I can help if you need me.

I learned a few things in the last few months while doing the same for packages in one complex system, which might be helpful.

If we do not decide to release this as a new major version, then we should keep TSC as the CJS compiler, for example, swc compiles it differently than TSC, and that will break for most people. If we decide to rework and release a new major version we can do anything we want.

I'd say candidates are https://swc.rs/ and https://rolldown.rs/

woss avatar May 26 '25 06:05 woss

@jimmy-guzman Hey Jimmy, I prefer staying with tsc. We may also check out the tsgo preview, I’m fine using tsgo to create the bundle if that works nicely (creating correct output/types/declaration files (if needed)).

Thank you for your help here šŸ™‚ I’m highly appreciating it!

marcuspoehls avatar May 26 '25 12:05 marcuspoehls