Uncaught TypeError: Vue.component is not a function Uncaught TypeError: Vue.component is not a function laravel laravel

Uncaught TypeError: Vue.component is not a function


After an update from laravel-mix 5.0.9 to laravel-mix 6.0.11 on a laravel 7 project it started to see this error on vue compiled views. I change the call the Vue package:

Use import Vue from 'vue' instead of window.Vue = require("vue"); worked for me.


import vue properly in your code using import keyword like this:

//import vueimport Vue from 'vue';//register componentVue.component('yourComponentName',require('./components/yourComponentName.vue').default);//initialize vueconst app = new Vue({    el: '#app',});


1

Change your package.json

"laravel-elixir-vue-2": "^0.3.0"

And run

<!-- language: lang-js -->npm install

OR

2

npm install laravel-elixir-vue-2 --save-dev

And then

Change your gulpfile.js like this

<!-- language: lang-js -->var elixir = require('laravel-elixir')require('laravel-elixir-vue-2');