-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert Library to support ES Modules #1107
Comments
Hi @JohanBjoerklund , Thanks for requesting this feature. Kind Regards, |
It would enable the use of advanced features like top level await. That is not possible for anyone using this package at the moment. |
Understood. I will add this feature to our Backlog. Kind Regards, |
I'd vote for this as well. When using esbuild as a bundler it is impossible to do a proper tree-shaking with commonjs modules. At least for now. ES modules convertion would be really helpfull. When you use library e.g. as a dependency in AWS lambda - even though ES imports work - the whole library is being bundled into final minified chunk. |
I'm having the exact same issue as @tpater. Due to the use of classes the library is massive and can't be tree shaken )': |
We have a project using vite, we had to polyfill the library so that it works, as vite converts esm, but due to they weird bundled code, it not longer allows the named exports. Here is the solution we implemented, but yea, this means no treashaking, but it's fine as we only use it server side. // lib/adyen/api-library.ts
import * as AdyenLib from "@adyen/api-library";
export type * from "@adyen/api-library";
const Adyen =
(AdyenLib as any as { default: typeof AdyenLib })?.default ?? AdyenLib;
export default Adyen; it would be great if the package could implement hybrid usage for the bundles: https://www.sensedeep.com/blog/posts/2021/how-to-create-single-source-npm-module.html |
@wboereboom Do you have an update on this? When using the lib in AWS Lambda and esbuild, we are getting a huge bundle size of 1.9MB where 1.4MB is from this library. Checkout, Terminal and other things are bundled even if we don't use it at all in our implementation. |
@DjoykeAbyah would you be able to help providing an update on this matter? Sorry to bother, I see you have been active in this repo and it would be great to get this improvement. |
Hi @ptlls! No problem at all! It wasn't in our initial roadmap at the time, but we will investigate this further. Currently, I don't have any updates on this matter, but I will get back to you as soon as I know more. Regards, Djoyke |
Is your feature request related to a problem? Please describe.
Support for esm modules, since it has been supported in node for a while now.
Describe the solution you'd like
Expose esm modulus.
Describe alternatives you've considered
Impossible to use alternative if you want access to top level await etc
The text was updated successfully, but these errors were encountered: