(aws-lambda-nodejs): Expose AssetStaging.exclude as prop to ignore node_modules from fingerprinting
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 74
Description
### Describe the feature
Add `bundling.exclude` property to `NodejsFunction` that is passed to the Asset [here](https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-lambda-nodejs/lib/bundling.ts#L64)
This would allow certain paths from being included in the fingerprint/assetHash giving developers more control without having to fully customize the hashing logic
### Use Case
When using the `NodejsFunction.nodeModules` property the listed modules (and their dependencies) are included directly in the bundled asset. This leads to the containing `node_modules` directory to directly influence the calculated `assetHash`. The contents of `node_modules` can be unstable for a large number of reasons leading to unnecessary deployments
### Proposed Solution
_No response_
### Other Information
_No response_
### Acknowledgements
- [x] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
2.181.1
### Environment details (OS name and version, etc.)
N/A
Contributor guide
Research direction
Start in packages/aws-cdk-lib/aws-lambda-nodejs/lib/bundling.ts at the Asset construction linked in the issue, then trace the NodejsFunction bundling props and relevant tests. Confirm that bundling.exclude is passed to AssetStaging and that excluded paths no longer affect the asset fingerprint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, node.js, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100