Recently, I started using Webpack and I was requiring jQuery using ‘require(“jquery”)’ and then I started getting errors in my app like so:
jQuery not defined or $ not defined
Then I found this piece here which explained that Webpack doesn’t set any global variables, so you have to set them yourself. So I did this:
window.jQuery = require('jquery');
window.$ = window.jQuery;
Happily this solved my issues.