Description
Use case
As a customer, I'd like to use Parser envelopes without having to import all of them at once, thus keeping my bundle size in check.
Right now if I use any one of the envelopes, they are all imported and included in my bundle since they're exposed only as a barrel export.
Basically I'd like to go from this:
import { ApiGatewayEnvelope } from '@aws-lambda-powertools/parser/envelopes';
to this:
import { ApiGatewayEnvelope } from '@aws-lambda-powertools/parser/envelopes/api-gatweay';
similar to what we're already doing for schemas.
Solution/User Experience
Since we're exporting a large number of modules that are under the same directory, I'd like to try using a more generic and scalable solution than the one I introduced a while back.
Instead of creating one entry for each item in the package.json#exports
field, we could instead use *
similar to this example.
The tradeoff here is that we'll need to be careful with what we put in the envelopes directory, but in this specific instance I think it's safe to do it since we're likely not going to add anything different there.
To keep names aligned with the exports we provided for schemas, we might have to rename some files.
Alternative solutions
Continue using the barrel export, which pollutes the bundle unnecessarily.
Acknowledgment
- This feature request meets Powertools for AWS Lambda (TypeScript) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status