Skip to content

Instantly share code, notes, and snippets.

@progapandist
Last active September 19, 2023 14:40
Show Gist options
  • Save progapandist/ca1bb494b4942bfbc0576e4ec436e53c to your computer and use it in GitHub Desktop.
Save progapandist/ca1bb494b4942bfbc0576e4ec436e53c to your computer and use it in GitHub Desktop.

Fixing Webpacker 3.3.0 + Rails 5.1.5

Heroku hosting trouble

Heroku may not detect a correct buildpack for your JS dependencies, then you have to set it manually:

heroku buildpacks:add heroku/nodejs -i 1
heroku buildpacks:add --index 2 https://github.com/heroku/heroku-buildpack-ruby

Execute line-by-line (don't cut&paste the whole block!) and then try git push heroku master again.

Rails can't find the manifest file

Run webpack-dev-server in a separate tab next to rails s

webpack-dev-server is not running

If the webpack-dev-server refuses to run, you might want to downgrade it, run yarn upgrade -D webpack-dev-server@^2.11.1. If it insists on installing a webpack-cli — do as the prompt tells you.

environment.js is broken

There's been an API change for Webpacker environment setup (to add jQuery as a global dependency, for instance). Change the line environment.plugins.set to environment.plugins.prepend while keeping the rest intact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment