Notes on deploying Webpack in a Phoenix application on Heroku

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 .gitignore file.

If you haven’t, add the following buildpacks to your heroku deploy.

# Set the buildpack for your Heroku app
heroku buildpacks:set

# Add this buildpack after the Elixir buildpack
heroku buildpacks:add --index 1

Add a file called compileto the root folder of your app, and add the call to webpack:

ENV=production node_modules/.bin/webpack

Note that ENV=production is optional and should relate to your webpack configuration.


Monitoring Phoenix

For the past month or so, I’ve looked at Elixir and Phoenix with interest. Phoenix is a young framework, still in beta, so tools are only starting to appear.

Michael Schäfermeyer has posted on Medium about monitoring in Phoenix, a welcome addition.

Here’s wishing for a quick port of Slim or Jade into Elixir.