1

App structure

I've got an app that's being deployed to Heroku. The folder structure looks like this:

- package.json // package.json for my backend.
- node_modules // My Express API node modules
- index.js // My Express API code
- client
-- package.json // package.json for my React-based frontend
-- ... folders from create-react-app

My backend package.json takes care of building the create-react-app frontend, by performing build command:

"build": "cd ./client && npm install && npm run build"

I've modified my frontend package.json as stated in this github issue comment. Everything seems to run fine, but then Heroku complains about exceeding maximum slug size (500mb).

My question

Can I somehow improve this configuration so the slug size stays under the limit? Seems like installing the puppeteer and chrome buildpacks takes a lot of slug space – can this be somehow minimized?

mdmb
  • 4,833
  • 7
  • 42
  • 90
  • Did you commit `node_modules`? – coreyward Jan 14 '20 at 18:27
  • @coreyward – I have them in my `.gitignore`. Maybe I should also put them in `.slugignore` – I will try this – mdmb Jan 14 '20 at 18:33
  • Assuming you don't have your dev dependencies installed as primary dependencies you should be okay there then. I know there's been a lot of chatter about various Node-targeted buildpacks being too bloated. Heroku is kind of a bad fit for Node apps, alas. – coreyward Jan 14 '20 at 18:36
  • I used to split my backend and frontend into two separate apps but decided to go for one this time. Adding the `node_modules` to `.slugignore` did not help unfortunately. – mdmb Jan 14 '20 at 18:50

0 Answers0