My highest-level component doesn't have this.$store
defined, resulting in errors. Immediately before my new Vue statement, I confirmed that the store was in fact created. Vue Devtools reports my store and shows it to have all the expected properties. Basically, the store isn't being injected into the component.
I'm using Laravel Mix and building for runtime only.I have reduced my configuration substantially to no avail.
I'm completely stumped on how to resolve this. The following SO posts are no help:
- This one used
this
in a lambda function. - This, this, this, this, and this come down to an overlooked detail.
app.js
import Vue from 'vue';
import BootstrapVue from 'bootstrap-vue';
import Vuelidate from 'vuelidate';
import Router from 'vue-router';
import Vuex from 'vuex';
import App from './layout/index';
Vue.use(BootstrapVue);
Vue.use(Vuelidate);
Vue.use(Router);
Vue.use(Vuex);
Vue.config.productionTip = false;
const store = new Vuex.Store({
});
new Vue({
store,
render: h => h(App),
}).$mount('#vm')
webpack.mix.js
const mix = require('laravel-mix');
require('laravel-mix-eslint');
mix
.js('resources/js/app.js','public/js')
.options({
processCssUrls: false,
})
.sass(
'resources/sass/app.scss',
'public/css',
{
implementation: require('node-sass'),
}
)
.styles(
[
'node_modules/bootstrap/dist/css/bootstrap.min.css',
'node_modules/bootstrap-vue/dist/bootstrap-vue.min.css'
],
'public/vendor.css'
)
if (mix.inProduction()) {
mix.version();
} else {
mix
.sourceMaps()
.webpackConfig({
devtool: 'cheap-eval-source-map', // Fastest for development
});
}