serverless-webpack
serverless-webpack copied to clipboard
Unable to exclude aws-sdk from bundle
This is a (Bug Report / Feature Proposal)
Description
For bug reports:
- The aws-sdk package gets bundled into the lambda.zip bundle
- The aws-sdk should not be bundled
- The config used is as follows:
webpack:
webpackConfig: ./webpack.config.js
includeModules:
forceExclude:
- aws-sdk
####
webpack:
webpackConfig: ./webpack.config.js
includeModules: true
excludeFiles: node_modules/aws-sdk/**
The aws-sdk has also been added as an external in the webpack config.
However the aws-sdk is still being included in the bundle.
Running a script like rm node_modules/aws-sdk
unfortunately throws an error. So I can't use that as a workaround.
Additional Data
- Serverless-Webpack Version you're using: 5.8.0
- Webpack version you're using: 5.74.0
- Serverless Framework Version you're using: ??
- Operating System: Windows
Would you mind try adding an exclude pattern in package
?
serverless.yml
package:
patterns:
- '!node_modeuls/aws-sdk/**'
Possible duplicate with #1218, see https://github.com/serverless-heaven/serverless-webpack/issues/1218#issuecomment-1214427420 for unconfirmed workaround.
@vicary I tried adding the exclude pattern in package
but that doesn't change anything. I also saw the duplicate, but none of the suggested workarounds or solutions do help.
@C5H8NNaO4 Thanks, that's unfortunate. There are many possible ways to have this happening, usually due to misconfiguration and oversights.
If a minimum reproducting repo is possible, please try to make one so we could pin point the problem.
@C5H8NNaO4 try this https://github.com/serverless-heaven/serverless-webpack/issues/1218#issuecomment-1269723395