Home > database >  Upgrading Laravel Mix to the latest version causes problems
Upgrading Laravel Mix to the latest version causes problems

Time:01-12

I am working on an app that before upgrading to Laravel 9 was working fine. I used Laravel Shift for the Laravel 9 upgrade and that bumped laravel-mix to the latest version 6.x and the problems started. I had some problems compiling which was weird but I fixed it. Now, I compile but I get the following error when I try to run the frontend:

Uncaught TypeError: Cannot read properties of undefined (reading 'silent')

this is the code that causes it:

VueI18n.prototype._initVM = function _initVM (data) {
  var silent = Vue.config.silent;
  Vue.config.silent = true;
  this._vm = new Vue({ data: data, __VUE18N__INSTANCE__: true });
  Vue.config.silent = silent;
};

I have no idea what this code is for?

I am running Vue version 2.5.22 with Laravel 9. Also, vue-i18n 8.28.2.

Here is my app.js:

import Vue from 'vue';
import router from './router';
import App from "./components/App";
import {store} from './store';

import Vuelidate from 'vuelidate';

import VueI18n from 'vue-i18n';

import { messages } from './locales/de';

const i18n = new VueI18n({
  locale: 'de', // default and only locale
  messages,
});

Vue.use(Vuelidate);

const app = new Vue({
    el: '#app',
    i18n,
    router,
    store,
    components: {
        App
    },
});

Googling reveals nothing. Any ideas?

CodePudding user response:

Try to include VueI18n as a component first before creating an instance:

Vue.use(VueI18n);
const il8n = new VueI18n({});
  • Related