Elixir recipes

Setting up Webpack

The preferred way to get assets working on Phoenix is by using Webpack. Phoenix v1.4 uses Webpack by default, but v1.3 and earlier versions use Brunch.

Adding Webpack to Phoenix v1.3

For Phoenix projects that were started with the default Brunch boilerplate, be sure to migrate to Webpack as soon as possible. This blog post describes how to do just that: Switching an existing Phoenix app from Brunch to Webpack (codemancers.com)

Just a few additions to the article:

  • Use --watch-stdin instead of --watch to prevent Webpack from staying in the background when terminating the Phoenix server.

  • Use yarn instead of npm install.