I've been working on a Django-React app for some time and finally got it pushed to Heroku today. I used a technique I saw in a DjangoCon-talk to serve my SPA from the Django Template view. I build the react-app manually and then target the index.html. I'm also using AWS S3 to store my static-files, and here is where my I'm stuck.
When I push to Heroku, the collectstatic will add my static files to AWS. However, the only way for me to access those static files is if I push the app, copy the static urls from AWS, paste them in the stylesheet/script-tags in my index.html and then push again.
Is there a way to dynamically create these when running npm run build?
Something like https://my-bucket.s3.amazonaws.com/static/js/{my_js_file}.chunk.js?
If this is impossible, is there any other solutions for this? Tips will be greatly appreciated.