Skip to content
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

Dual module exports with ES Module support #606

Closed
antstanley opened this issue Oct 18, 2023 · 0 comments · Fixed by #607
Closed

Dual module exports with ES Module support #606

antstanley opened this issue Oct 18, 2023 · 0 comments · Fixed by #607

Comments

@antstanley
Copy link
Contributor

Currently DynamoDB Toolbox transpiles to CommonJS. This causes some issues when trying to use Lambda with ESM functions. If I bundle my function, and include the AWS SDK v3 in the bundle my function it works, if I exclude the AWS SDK from the bundle it doesn't work, because DynamoDB Toolbox attempts to require the files instead of import.

The AWS SDK is shipped with Lambda, and for my particular function when bundled is over 80% of the size of the function, so I don't want to bundle it.

Shipping an ES module version of DynamoDB toolbox will resolve this and allow me to exclude the AWS SDK's from my bundle.

I recently worked with the AWS Powertools team to implement dual module support in the upcoming v2 of Powertools. Happy to do the same here to implement it quickly.

I'm going to work on a quick PR to resolve this and submit it to be proactive on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant