fix: esm builds
#322
Thanks for the PR, but we won't be merging this one, definitely not in such shape. If we are to change the monorepo setup, we will handle it ourselves, we are not interested in a complete rewrite like this. Also I hope you don't expect us to merge a PR that is doing so many things at once, including changing package manager, and doing many breaking changes like changing the TS configs completely.
I will leave it open, as I feel like parts of it might be usable at least as an inspiration.
Note that we are considering going ESM native in next major instead of dealing with dual builds (especially since there is now the experimental support for require(esm) in both node 20 and 22). It will likely happen later this year.
Closing since we already have a first version of v4 available on NPM which is native ESM (code lives in https://github.com/apify/apify-sdk-js/tree/v4 branch).