A buildpack to support Heroku deployments with webpack-rails.
Note: webpack-rails gem is not longer maintained by its developer.
Add a custom buildpack to your to your applications Settings tab under section Buildpacks by using the URL of this repository, instead of the short name of Heroku's own buildpacks. It goes alongside your Ruby and Node buildpacks, placed in last position.
After the release of registered buildpacks, it will be available under
the name febeling/webpack-rails
, adhearing to the suggested naming
conventions there.
First, check your Heroku app has the Ruby and Node buildpacks added, in the command line run:
heroku buildpacks
If they are added you should see:
your-app-1234 Buildpack
1. heroku/nodejs
2. heroku/ruby
To add the Webpack Rails buildpack in the last index, run this command:
heroku buildpacks:add --index 3 febeling/webpack-rails
On deployment, the buildpack runs the build command bundle exec rake webpack:compile
. Under default configuration that will output the
compiled assets under public/webpack
.
Heroku supports both NPM and Yarn as Javascript package managers. This buildpack will
detect which one to use automatically, based on the persence of a version-lock file.
Projects that use yarn have
a yarn.lock
file, while those that use npm have a package-lock.json
(or none if using an older version of npm
).
This buildpack will set the YARN
environment variable accordingly, which
will make that the effective package manager for Javascript.
The febeling/webpack-rails
buildpack from the Heroku Registry contains the latest stable version of the buildpack. If you'd like to use the latest buildpack code from this Github repository, you can set your buildpack to the Github URL:
heroku buildpacks:add --index 3 https://github.com/febeling/webpack-rails-buildpack
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Started on 5 June 2016.
Created by Florian Ebeling.
See LICENSE.md file.