import Vue from 'vue'
import Vuex from 'vuex'
import auth from './stores/auth'

Vue.use(Vuex);

const isDebug = process.env.NODE_ENV !== 'production';

const store = new Vuex.Store({
    modules: {
        auth: auth,
    },
    strict: isDebug
});

export default store
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

// Include All Store
const files = require.context('./stores', true, /\.js$/i);
let modules = {};
files.keys().forEach(key => {
    modules[key.split('/').pop().split('.')[0]] = files(key).default;
});

const isDebug = process.env.NODE_ENV !== 'production';

const store = new Vuex.Store({
    modules: modules,
    strict: isDebug
});

export default store
更改 store 的匯入方式，讓它可以自動匯入所有 modules