charles
charles

Reputation: 384

ReferenceError: Vue is not defined (laravel)

I know there have lots of similar questions of this but I couldn't find a solution from those.

Already installed npm of vue and successfully compiled using npm run dev, I don't know why it return this kind of error below.

ReferenceError: Vue is not defined

This is my setup in my app.js:

import Vue from 'vue';
import VueRouter from 'vue-router';

window.Vue = Vue;
Vue.use(VueRouter);

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

In my welcome.blade.php

<html>
    <head>
        <meta name="csrf-token" content="{{ csrf_token() }}">
        <link href="{{ mix('css/app.css') }}" rel="stylesheet">
    </head>

    <body>
        <div id="app">
            <button class="btn btn-primary">Sample</button>
        </div>

        <script src="{{ mix('js/manifest.js') }}"></script>
        <script src="{{ mix('js/vendor.js') }}"></script>
        <script src="{{ mix('js/app.js') }}"></script>
    </body>
</html>

Someone knows where I went wrong?

Upvotes: 0

Views: 1475

Answers (1)

tempra
tempra

Reputation: 2331

I'm curious on what's inside your bootstrap.js. Maybe can you show us, might you import something that is using Vue, on which apparently fail to import.

Upvotes: 0

Related Questions