For new apps, pass
--skip-webpack-install and you’re good to go.
For existing apps follow these steps:
- Remove the webpacker gem,
bundle installand restart.
yarn remove @rails/webpacker.
rm -r config/webpacker.
- Change any
//= require Xany libs you need.
You can still use yarn to handle the js dependencies. An example
application.js file from a recent project:
//= require jquery //= require bootstrap/dist/js/bootstrap //= require tablesorter
Heroku compilation issues
Without the webpacker gem installed, if you are deploying on heroku, you will need to add the nodejs buildpack to ensure your npm packages are installed before the app is built:
heroku buildpacks:add --index 1 heroku/nodejs
Done and dusted.