0๐
โ
Ok, I solved it:
form.js
// Element added manually due to new Vue 3 structure
import { createApp } from 'vue';
//
// New "createApp" structure to substitute Vue 2 "const app = new Vue" code
let form = createApp({
el: '#form',
methods: {
clickme: function () {
alert('Hello World');
console.log('Its working');
},
},
})
form.mount("#form");
//
app.js
import './bootstrap';
import Alpine from 'alpinejs';
// Element added manually due to new Vue 3 structure
import { createApp } from 'vue';
//
window.Alpine = Alpine;
Alpine.start();
window.Vue = require('vue').default;
if ($('#form').length > 0) {
require('./form.js');
} else {
// New "createApp" structure to substitute Vue 2 "const app = new Vue" code
let app = createApp({
el: '#app',
});
app.mount("#app");
//
}
Source:stackexchange.com