'Can I slugignore `node_modules`, `tmp` and `storage` folders?

I want ways to reduce my slug size, and I was wondering if it will be ok to ignore those folders /node_modules, /storage, /tmp, or will that bring me some issues?

Also, please let me know any other tip you may have to descrease the slug size.



Solution 1:[1]

TL;DR You can remove node_modules from your slug.


But what I acctually did was to add the next build pack as the last buildpack in Heroku web site, and it significantly reduced my slug size:

Buildpacks

and also I created a file called .slug_post_clean adding a line with node_modules.

It is very important to put it as the LAST buildpack, if not, then it won't be very efficient.

Likely you can accomplish the same thing without this buildpack.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dani24