lambda-nodejs: Use OutputFormat.ESM by default for .mjs and .ts files #28840
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
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 ofexports.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
CDK version used
2.122.0
Environment details (OS name and version, etc.)
Mac Sonoma
The text was updated successfully, but these errors were encountered: