-
Notifications
You must be signed in to change notification settings - Fork 140
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
Feature request: Add support for ES Modules with esbuild. #426
Comments
Hey @santiperone, thanks for reporting this. SAM-CLI should already be exposing the format property, though I see it missing from our documentation which we will fix. Can you try using one of the supported esbuild formats as defined in their documentation and see if it works |
Hi @mildaniel Thanks fo your response. You're right, there's actually a "Format" property that allows to set the output format to "esm". However, the output file still has ".js" extension instead of ".mjs" which makes the lambda runtime treat it as commonJs and makes it impossible to run. Also, is there any way of setting some of the esbuild properties globally? It's kind of a pain having to set that up on every function. |
Hey @santiperone. I moved the issue to the Lambda Builders repository. This is our build engine that handles the relevant logic. I also opened a pull request to add support for the
As for your configuration concern, it's one we've heard before and are actively working on. |
This has now been released in AWS-SAM-CLI version 1.72.0! |
Describe your idea/feature/enhancement
Currently, when trying to use ES modules features (as described in https://aws.amazon.com/es/blogs/compute/using-node-js-es-modules-and-top-level-await-in-aws-lambda/) together with esbuild, some errors are thrown because the default output format for esbuild is .cjs, which doesn't support those.
Proposal
Add some option to change the output format to .mjs (maybe it could even be the default value)
The text was updated successfully, but these errors were encountered: