---
title: "Comment by Abdullah T on \"Cleanup the node_modules for a lighter Lambda Function\" | Hashnode"
description: "Nice article, I didn&#39;t know about the prune. Normally I just use webpack and serverless framework and run the optimisations on webpack itself. but the deplo"
url: "https://hashnode.com/posts/cleanup-the-nodemodules-for-a-lighter-lambda-function/5fd066a108c38b30aa6fed5a/comment/5fd0962f6e02ab3685f9131f"
---

[Discussion](https://hashnode.com/posts/cleanup-the-nodemodules-for-a-lighter-lambda-function/5fd066a108c38b30aa6fed5a)

Comment [Cleanup the node\_modules for a lighter Lambda Function](https://hashnode.com/posts/cleanup-the-nodemodules-for-a-lighter-lambda-function/5fd066a108c38b30aa6fed5a)

[Abdullah T](https://hashnode.com/@abbadev)

[Dec 9, 2020](https://hashnode.com/posts/cleanup-the-nodemodules-for-a-lighter-lambda-function/5fd066a108c38b30aa6fed5a/comment/5fd0962f6e02ab3685f9131f)

Nice article, I didn't know about the prune. Normally I just use webpack and serverless framework and run the optimisations on webpack itself.

> but the deployment package has to restrict to 500MB

I think you mean 250Mb.

From the [docs](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html), the deployment package can be:

-   50 MB (zipped, for direct upload)
-   250 MB (unzipped, including layers)
-   3 MB (console editor)

or now up to 10Gb if you are using a container image.

[Vikas Solegaonkar](https://hashnode.com/@solegaonkar)

[Dec 9, 2020](https://hashnode.com/posts/cleanup-the-nodemodules-for-a-lighter-lambda-function/5fd066a108c38b30aa6fed5a/comment/5fd0962f6e02ab3685f9131f#reply-5fd0c2c849835e38d0a9b6e0)

Thanks for your inputs. [docs.aws.amazon.com/lambda/latest/dg/runtimes-wal…](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-walkthrough.html)

500 Mb (512 to be precise) is the net allowed - including the runtime itself - that is if you take up the a custom runtime.

Of course, things have changed with the container in Lambda. But that has impact on the pricing as well.

The serverless framework itself brings in so much to the deployment - it ends up blowing up the deployment size.

I had not tried the webpack before. Tried it after your comment. But I saw it had problems with non js code in the node\_modules. It was wonderful with pure js code. Any way to overcome that?
