serverless-esbuild icon indicating copy to clipboard operation
serverless-esbuild copied to clipboard

Option "exclude" not working as expected with value '*'

Open nbusser opened this issue 2 years ago • 1 comments

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 '*' esbuild

  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 esbuild2

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 esbuild3

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 avatar Jan 03 '23 10:01 nbusser

@nbusser gonna look at it, thank you for raising the bug.

floydspace avatar Jan 03 '23 12:01 floydspace