You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:)
The text was updated successfully, but these errors were encountered:
I believe import type statements are stripped altogether at compilation by Typescript, and are therefore not used during bundling phase. You can learn more about this in https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html. That's why aws-sdk is not part of this library at all, and solely used as a dev dependency in order to run tests on the actual implementation.
However, you should indeed in your lambda implementation using typebridge make sure to instantiate EventBridge client using import EventBridge from 'aws-sdk/EventBridge';
Did you see some problem in bundling even implementing SDK client import as described above ?
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 justEventBridge
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:)
The text was updated successfully, but these errors were encountered: