JS not working unless I change order in webpack.mix.js

Hi,

Suddenly my JS stopped working. I can see it enqueued in the footer. No errors, no nothing but it wasn’t executing until I decided to add a completely separate file test.js (not in the image) and enqueue it + add it to webpack.mix.js.

test.js worked. Removing it from webpack.mix would cause JS to stop working again.

Then I discovered that the only solution without extra/empty JS files was to re-order app.js to the second line (after a JS admin file I need).

image

Has this ever happened to anyone? I’m happy it works but I’m not sure if this “solution” is concealing a bigger problem. Not to mention it’s annoying not knowing why this is happening.

Thanks in advance,
Sam

P.S. Before all this webpack.mix.js stuff, I tried deleted node_modules and yarn it several times.