Closed longnguyen2004 closed 9 months ago
Probably we'll stay with CJS for now. It's good to see that you're into ESM :) However there is still others that need to switch, and the number of them is yet to increase.
/cc @B4nan
Yes, this package will stay CJS for now as we need it to be CJS. We will probably make it part of the Apify SDK monorepo in upcoming months, where we plan to ship hybrid ESM support via gen-esm-wrapper
. Let's hope the ESM support will get better soon and we will be able to use ESM version of got
directly, until then, we will depend on the CJS fork.
Any particular reason this package can't target both ESM and CJS?
I'm working with AWS lambdas, which started to support native ESM and Node16 recently. To get benefits of dead code elimination it doesn't help to just wrap CJS code, it needs to use static imports and exports instead.
It's been 2023, and ESM support in Node is pretty solid by now. When will we switch to ESM?
Want to throw a +1 vote for ESM as well. While there are still rough spots in tooling (e.g. eslint-plugin-import
notably has numerous issues w.r.t ESM and package.json exports
, and the lead maintainer there is quite stubborn in his refusal to support it), the "base" tooling (node/package management/IDE/typescript/jest/etc) is good enough that I've been able to migrate over my codebase to ESM piece by piece.
Furthermore, it's clear that having to maintain got-cjs
, keeping it up to date with baseline got
(i.e. it's now a major version behind), and keeping the imports of got-scraping's dependencies "kosher" (some of the non-got dependencies are now ESM-only as well), is only going to further increase the "resistance" of keeping things up to date, so to speak:
FYI we will be moving this package to ESM in the following months, it just wasn't a priority but we were planning it for quite some time now.
Really great to see it, I'll be looking forward to it!
Closing in favor of #108
I'm trying to use ESM everywhere in my project, so I want my dependencies to be ESM. I happened to use both
got
andgot-scraping
in a project, but I noticedgot-scraping
depends ongot-cjs
, whilegot
is now ESM, which means there are 2 differentgot
versions installed. Willgot-scraping
eventually switch to ESMgot
, when v12 is out of beta?