Louwki's avatar

Upgraded Laravel to 5.4 from 5.3 ReferenceError: $ is not defined

Im getting this on all pages now, the only thing I did was change to the new laravel 5.4 package in composer and ran update, now run gulp i get this on all pages. I tried adding jquery directly on a page, from bootstrap file and it has always been defined in the gulp file to include in te project.

bootstrap

window.$ = window.jQuery = require('jquery');

gulpfile

mix.scripts([ '../../../resources/assets/vendors/jquery/jquery-2.1.1.min.js' ], 'public/js/jquery.js');

blade

error

Uncaught ReferenceError: $ is not defined

on some pages i get

Uncaught ReferenceError: jQuery is not defined

aswell

Any help would be greatly appreciated. Thanks

0 likes
1 reply
Louwki's avatar

Seems like for some reasons @push() blade adds the jquery include after the code on the layout page. where as in 5.3 it added it before custom code.

Please or to participate in this conversation.