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
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
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