mercredi 25 octobre 2017

Laravel 5.5 ReferenceError: $ is not defined

For some reason my jQuery refuses to load. I am getting an error:

ReferenceError: $ is not defined

My template is in views/layouts/editor.blade.php and I am loading jQuery in the head of my template like this

<script src=""></script>

I can see that jQuery is loaded in my console. but still I get the error.

I am compiling my javascript using laravel mix and my webpack.mix.js file looks like this:

// javascript
mix.js('resources/assets/js/app.js', 'public/js')
   .js('node_modules/jquery/dist/jquery.min.js', 'public/js')
   .autoload({
        jquery: ['$', 'window.jQuery', 'jQuery'],
    });
// css
mix.sass('resources/assets/sass/app.scss', 'public/css')
   .sass('node_modules/bootstrap/scss/bootstrap.scss', 'public/css');

Why is this happening?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2gD9Mag
via IFTTT

Aucun commentaire:

Enregistrer un commentaire