As of today, there’s no Heroku buildpack specifically built for deploying Phoenix and Webpack. Having found no consolidated place to learn how to do it, here’s what I did.
First, make webpack run in your local environment. This link explains it well.
Make sure to comment out
/priv/static in your
If you haven’t, add the following buildpacks to your heroku deploy.
# Set the buildpack for your Heroku app heroku buildpacks:set https://github.com/gjaldon/phoenix-static-buildpack # Add this buildpack after the Elixir buildpack heroku buildpacks:add --index 1 https://github.com/HashNuke/heroku-buildpack-elixir
Add a file called
compileto the root folder of your app, and add the call to
ENV=production is optional and should relate to your webpack configuration.