serverless-esbuild
serverless-esbuild copied to clipboard
Option "exclude" not working as expected with value '*'
Describe the bug
I want to use an AWS layer to store all my node_modules
dependencies.
Thus, following the documentation of esbuild serverless plugin, I set exclude
option to '*'
exclude: '*'
I then run npx sls package --stage dev
and check the size of the generated package:
The size of the bundled package is approximately 3.5MiB
Now, I explicitely specify the packages I want to exclude. I set all the modules contained in my package.json
exclude: [
'aws-sdk',
'@magic-sdk/admin',
'@middy/*',
'@pinata/sdk',
'checkout-sdk-node',
'jsonwebtoken',
'mongoose',
'web3',
],
I rebundle the microservice and check the size of the generated package:
The size of the bundled package is approximately 9KiB
NB: I also tried with exclude: ['*']
and had the same results as exclude: '*'
Versions (please complete the following information):
- OS: Mac
- Serverless Framework Version: 3.25.1
- Plugin Version: 1.33.1
@nbusser gonna look at it, thank you for raising the bug.