Skip to content

Conversation

cogwirrel
Copy link
Contributor

Reason for this change

Rolldown tree-shakes the AWS SDK too aggressively and removes required code. See the following issue for details: rolldown/rolldown#6513

Description of changes

This change ensures that any bundles targeting lambda are generated with the AWS SDK as external as it's provided by the lambda runtime (ts#smithy-api and ts#trpc-api were missing this - ts#lambda-function already had this set).

For projects which don't target lambda and don't externalise the AWS SDK (only ts#mcp-server right now which runs on agentcore runtime), we disable tree shaking for AWS SDK dependencies via a custom plugin.

Additionally set platform to node by default in rolldown config - when omitted rolldown defaults to browser but we're only using it for bundles targeting the node runtime.

Description of how you validated changes

Unit tests. Deployed a ts#mcp-server which uses the dynamodb client.

Checklist


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

… rolldown bug

Rolldown tree-shakes the AWS SDK too aggressively and removes required code. See the following
issue: rolldown/rolldown#6513. This change ensures that any bundles
targeting lambda are generated with the AWS SDK as external as it's provided by the lambda runtime
(ts#smithy-api and ts#trpc-api were missing this - ts#lambda-function already had this set). For
projects which don't target lambda and don't externalise the AWS SDK, we disable tree shaking for
AWS SDK dependencies (only ts#mcp-server which runs on agentcore runtime)
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.27%. Comparing base (8486855) to head (a804939).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #327      +/-   ##
==========================================
+ Coverage   96.25%   96.27%   +0.02%     
==========================================
  Files          91       91              
  Lines        9002     9052      +50     
  Branches     1084     1092       +8     
==========================================
+ Hits         8665     8715      +50     
  Misses        327      327              
  Partials       10       10              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cogwirrel cogwirrel merged commit c9f5792 into main Oct 14, 2025
12 checks passed
@cogwirrel cogwirrel deleted the fix/rolldown-bundle branch October 14, 2025 02:40
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 this pull request may close these issues.

3 participants