Using Laravel Mix on Heroku
This blog post was originally published a little while ago. Please consider that it may no longer be relevant or even accurate.
Setting up Laravel Mix on Heroku is very similar to how you'd set it up with Elixir. Because Laravel puts your front-end dependencies in devDependencies
instead you just need to tweak the default configuration.
First, set YARN_PRODUCTION
to false
using the following command. This tells Heroku to install the devDependencies
in your package.json
, but leaves NODE_ENV
as production.
Next, set the engines in your package.json
. Make sure you have yarn
at least 0.19.1
so that it respects the YARN_PRODUCTION
environment variable.
Also add the postinstall
key to scripts
so that Heroku will compile your assets as you expect after everything has been installed.