I am trying to work out why importing that script makes a difference.
Just because it worked before doesn’t mean it’s a good idea.
Mixing in-page script and modules is a Bad Idea™.
If you plan to use webpack move your code into a module (or all of it into app.js
). I described the process in principle here (for Brunch - but the idea is the same). For some more background into bundling see Modern JavaScript Explained For Dinosaurs.