I’m using Laravel 11 mix and i have a problem with Alpine wich is load 2 times when i connect on my website in local. If it’s possible, i prefer to stay in mix i already tried to go on laravel vite but i have a problem with my Jquery and Bootstrap. here is the error i have :
livewire.js?id=87e1046f:9882 Detected multiple instances of Alpine running
and here is my code :
app.js :
import Alpine from 'alpinejs';
window.Alpine = Alpine;
Alpine.start();
require('./sb-admin-2');
bootstrap.js
window._ = require('lodash');
try {
//window.Popper = require('popper.js').default;
window.$ = window.jQuery = require('jquery');
//require('jquery.easing')(window.jQuery);
require('bootstrap');
} catch (e) {
}
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
and finaly my webpack.mix.js :
const mix = require('laravel-mix');
require('laravel-mix-purgecss');
mix.webpackConfig({
stats: {
children: true
}
});
mix.js("resources/js/app.js", "public/js")
.js("resources/js/bootstrap.js", "public/js")
.sass( "resources/sass/app.scss", "public/css")
.purgeCss(
);
I saw on forum that is possible to solve it by going on laravel vite but do u know if there is other options ?
I have thoses versions :
"@fortawesome/fontawesome-free": "^5.15.4",
"alpinejs": "^3.8.1",
"bootstrap": "^4.6.1",
"jquery": "^3.6.0",
"npm": "^10.8.1",
"popper.js": "^1.16.1"