I am developing a Front-end Application and hosting via Heruko
The Problem is that the slug size is too large when i investigated the issue I find out there is files like
/node_modules
/build
/src
/public
package.json
package-lock.json
tsconfig.json
README.md

The Official document says to use .slugignore file
but the problem is that i need to use src and other files in build process
I have found a solution for that but using this heroku-buildpack-post-build-clean
when i tried it i am able to remove
/src
/public
package.json
package-lock.json
tsconfig.json
README.md
if i remove the
/node_modulesthe Application Just Crash

my scripts inside package.json file
"scripts": {
  "heroku-prebuild": "npm install -g serve",
  "devstart": "react-scripts start",
  "start": "serve -s build",
  "build": "react-scripts build"
},
now the file size is 465MB

can anyone knows how to safely remove /node_modules or how to better Do it.
the /node_modules size is larger than 410MB
Thanks in Advance
I am able to solve it using
heroku-buildpack-post-build-clean
and using .slug-post-clean file
src
public
README.md
node_modules
I need package.json file only on heruko with build folder
Now the slug size is 57.9 MB that is 400 MB less

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With