mcardosob
1 year ago

Load js dependecy in my bootstrap.js

Posted 1 year ago by mcardosob

My problem

I want to use admin-lte in my laravel app. For this I want to require this js dependecy, I do this in my bootstrap.js (laravel-mix).

But the js isn't loaded, so for test I writed console.log('bootstrap.js loaded') in my bootstrap.js file, but the test isn't printed.

How to help me

The boostrap.js is loaded by default? I have the same problem with jquery, it isn't loaded, this is not normal I think.

My code

(resources/assets/js/bootstrap.js)

    try {
        window.$ = window.jQuery = require('jquery');
    
        require('bootstrap');
    } catch (e) {}
    
    require('admin-lte')
    console.log('bootstrap.js loaded')

(webpack.mix.js)

    mix
      .disableNotifications()
      .js('resources/assets/js/app.js', 'public/js')
      .sass('resources/assets/sass/app.scss', 'public/css');

Please sign in or create an account to participate in this conversation.