3

I have used serverless-webpack npm module to reduce the size of my nodeJs serverless application but apparently the size is gtting increased from 15M to 85MB with usage of this packag and i am unable to deploy to lambda.

Do we have any other ways to reduce the size of node lambda function to ignore sending node_modules and improve the speed of th lambda function.

1 Answers1

0

I'd recommend you to use esbuild-loader for webpack, as it is more effective and provides really good tree-shaking (bundling only code which is really used by your application rather than bundling everything).

As an alternative, you may use the corresponding serverless plugin, but since you already have webpack configured it may be more convenient to use the first option.

Artem Arkhipov
  • 7,025
  • 5
  • 30
  • 52