I've got a Flask app that also serves a React frontend by serving files from a /build
folder that gets generated when I run npm run build
.
My directory structure:
.
|-client/
| |build/
| |static/
|
|-server/
| |main.py
In order to deploy my app to Heroku, I have to...
- cd into client
- run npm run build in order to generate the new static build of the react app
- commit the changes to git
This works, but it's definitely a pain. It creates HUGE diffs in Github when we create PRs.
I'm wondering, is it possible to run npm run build
in the Heroku pipeline? I think the Procfile is the way to go. I've tried a couple of things like adding
npm: cd client && npm run build
web: flask db upgrade; gunicorn wsgi:app
to no avail.