2 years ago

Uncaught ReferenceError: Vue is not defined

Posted 2 years ago by fullstackfox16

I can't figure out why I'm getting this error

    app.js:1041 Uncaught ReferenceError: Vue is not defined
    at Object.VERSION (app.js:1041)
    at __webpack_require__ (app.js:20)
    at Object.<anonymous> (app.js:980)
    at __webpack_require__ (app.js:20)
    at Object.<anonymous> (app.js:965)
    at __webpack_require__ (app.js:20)
    at app.js:63
    at app.js:66

Here is my app.js

 * First we will load all of this project's JavaScript dependencies which
 * includes Vue and other libraries. It is a great starting point when
 * building robust, powerful web applications using Vue and Laravel.


window.Vue = require('vue');

Vue.config.devtools = true;

 * Next, we will create a fresh Vue application instance and attach it to
 * the page. Then, you may begin adding components to this application
 * or customize the JavaScript scaffolding to fit your unique needs.

Vue.component('flash', require('./components/Flash.vue'));
Vue.component('reply', require('./components/Reply.vue'));

const app = new Vue({
    el: '#app'

Here is my bootstrap.js

window._ = require('lodash');

 * We'll load jQuery and the Bootstrap jQuery plugin which provides support
 * for JavaScript based Bootstrap features such as modals and tabs. This
 * code may be modified to fit the specific needs of your application.

try {
    window.$ = window.jQuery = require('jquery');

} catch (e) {}

 * We'll load the axios HTTP library which allows us to easily issue requests
 * to our Laravel back-end. This library automatically handles sending the
 * CSRF token as a header based on the value of the "XSRF" token cookie.

window.axios = require('axios');

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

 * Next we will register the CSRF Token as a common header with Axios so that
 * all outgoing HTTP requests automatically have it attached. This is just
 * a simple convenience so we don't have to attach every token manually.

let token = document.head.querySelector('meta[name="csrf-token"]');

if (token) {
    window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
    console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');

window.events = new Vue();

window.flash = function (message) {
    window.events.$emit('flash', message);

Any help would be greatly appreciated! Thanks in advance!

Please sign in or create an account to participate in this conversation.