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

lambda-nodejs: Use OutputFormat.ESM by default for .mjs and .ts files #28840

Open
1 of 2 tasks
piotrekwitkowski opened this issue Jan 24, 2024 · 0 comments
Open
1 of 2 tasks
Labels
@aws-cdk/aws-lambda-nodejs effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@piotrekwitkowski
Copy link

Describe the feature

When my entrypoints are either .mjs and .ts files, I would like the ESM output format to be used by esbuild.

Use Case

Both .mjs and .ts files are written with ES modules in mind. They usually use the export const handler syntax instead of exports.handler. When bundled to CJS, we get a bit of boilerplate in the output which can be prevented by automatically detecting that and using ESM output format.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.122.0

Environment details (OS name and version, etc.)

Mac Sonoma

@piotrekwitkowski piotrekwitkowski added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jan 24, 2024
@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda-nodejs effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

2 participants