I\'m trying to install jQuery in Rails 6.0.0.rc1 via Webpack and I\'m not sure what I\'m missing but I\'m getting the error $ is not defined
in the browser console
I tried a lot of things and some worked and some didn't, and some didn't work in my Docker container. In the end I settled on putting this in app/javascript/packs/application.js
:
global.$ = require('jquery')
You need to do yarn add jquery
of course.
I'm sure there are better ways but this is the only thing that worked for me so I'm putting it up here in case it helps anyone else.