Skip to content

Update imports syntax in v0.x to reduce cold start duration #16

@Eikix

Description

@Eikix

Context: aws-sdk v2 uses cjs and thus does not tree shake. This means that the following syntax:
import type { EventBridge } from 'aws-sdk'; will result in importing aws-sdk package in its entirety, rather than just EventBridge type.

Note that this is fixed in aws-sdk v3.

Impact: Increasing cold starts for lambdas (up to +1.3s on cold start duration).
How? For instance, a lambda uses this package (v0.7) when sending an event to EventBridge.

Proposed fix: In versions < 1, adopt the following import syntax:
import type EventBridge from 'aws-sdk/EventBridge';

Thanks:)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions