Laravel-mix: Extract "vuex" causes fatal error

Created on 27 Feb 2017  路  4Comments  路  Source: JeffreyWay/laravel-mix

In laravel mix v0.8.8:

When I extract to vendor file:

.extract([
        'vue', 'vuex',
    ], 'public/assets/js/vendor');

The page shows error:

Uncaught Error: [vuex] must call Vue.use(Vuex) before creating a store instance.

Previously working as of v0.8.0

Most helpful comment

I believe its cause of vue 2.2

https://vuejs.org/v2/guide/typescript.html#Important-2-2-Change-Notice-for-TS-webpack-2-users

All 4 comments

Maybe you should call Vue.use(Vuex) before creating a store instance? :)

It's not the Mix issue. Probable solution:

import Vue from 'vue';
import Vuex from 'vuex';

import store from '../path/to/your/storage';

Vue.use(Vuex);

new Vue({
    store,

    el: '#app',

    data: {
        // private state
    }
});

It works perfectly @v0.8.0, however, when I upgrade to v0.8.8, it just breaks.

I have do call Vue.use(Vuex); in require('./bootstrap'); which is few lines before

Without seeing your source code, we can't really debug this. @Glorian's example works.

I believe its cause of vue 2.2

https://vuejs.org/v2/guide/typescript.html#Important-2-2-Change-Notice-for-TS-webpack-2-users

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wendt88 picture wendt88  路  3Comments

sdebacker picture sdebacker  路  3Comments

dtheb picture dtheb  路  3Comments

rderimay picture rderimay  路  3Comments

kpilard picture kpilard  路  3Comments