K
K
kiranananda2021-05-12 16:24:37
Vue.js
kiranananda, 2021-05-12 16:24:37

Why doesn't vue2 work in latest Laravel?

I put the latest build of laravel. I already understood it as it is imprisoned for vue3. I put my project on vue2 and I get an error in the browser console:

undefined is not an object (evaluating 'Vue.version.split')


In webpack like this:
mix.js('vendor/vkiranananda/backend/resources/js/backend.js', 'public/backend/js/admin.js').vue({ version: 2 }).version();

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Anton, 2021-05-12
@Fragster

You need to manually import into the Vue entry point:

// src/app.js

import Vue from 'vue'; //////// <---
import Alert from './Alert.vue';

new Vue({
    el: '#app',
    components: { Alert }
});

A
Anton Anton, 2021-05-12
@Fragster

You need to import in the Vue component:

// src/app.js

import Vue from 'vue';
import Alert from './Alert.vue';

new Vue({
    el: '#app',
    components: { Alert }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question