Skip to content

docs(lambda-nodejs): preserve decorator metadata during pre-compilation - #39332

Open
caglarkc wants to merge 2 commits into
aws:mainfrom
caglarkc:docs/nodejs-decorator-metadata-21168
Open

caglarkc wants to merge 2 commits into
aws:mainfrom
caglarkc:docs/nodejs-decorator-metadata-21168

Conversation

@caglarkc

@caglarkc caglarkc commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Issue # (if applicable)

Closes #21168.

Description

preCompilation hands the JavaScript entry point emitted by TypeScript to esbuild, but extensionless imports can still resolve to adjacent TypeScript sources. Those imported modules are then compiled without decorator metadata. Document the confirmed --resolve-extensions=.js workaround, the required compiler configuration, and its limitation that imported JavaScript must exist.

Validation

  • The README example compiled and translated with jsii-rosetta (1 snippet, no diagnostics).
  • A real TypeScript/esbuild reproduction confirms default extensionless imports lose imported decorator metadata and --resolve-extensions=.js preserves design:paramtypes at runtime.

Documentation only; no changes to bundling behavior or synthesized infrastructure.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.

@github-actions github-actions Bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Oct 16, 2026
@aws-cdk-automation
aws-cdk-automation requested a review from a team October 16, 2026 13:36
@maintainer-for-aws

Copy link
Copy Markdown

Automated review

A maintainer will still review this — treat the notes below as a starting point.

📌 Commit 4db5ef3

This PR is a documentation-only change to the aws-lambda-nodejs module. It adds five lines of JSDoc to the existing preCompilation property on BundlingOptions (lib/types.ts) and expands the "Pre Compilation with TSC" section of the README with a worked example showing how to set esbuildArgs: { '--resolve-extensions': '.js' } so that decorator metadata is preserved for imported modules during pre-compilation.

The change introduces no public API surface change, no signature change, and no synthesis or behavior change. The documented esbuildArgs usage is valid against the existing esbuildArgs?: { [key: string]: string | boolean } signature, and all referenced properties (preCompilation, tsconfig, entry) are real existing members, so the README example type-checks and carries no regression risk. No issues found on this change.

🔴 0 blocking · 🟡 0 recommended · ⚪ 0 optional


Generated automatically. React 👍 or 👎 to tell us whether this review helped, so we can improve these reviews.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Oct 16, 2026

This branch was previously deployed

1 inactive deployment
automation — 4db5ef37 Deployed Oct 16, 2026 by aws-cdk-automation via validate-pr #372941
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-lambda-nodejs: preCompilation flag: npm run build creates different *.js then npm run cdk diff/deploy

2 participants