Module not found: Error: Can't resolve 'vuex'

Hi Zazoe,

the “Module not found” Error is risen, because Webpack treats your plugin and the aministration core as two different "project"s that can only share exported functionality. So for every library you want to use you must add it as a dependenciy in your package.json and install your dependencies just as you did.

Because we know that installing Vuex on every plugin, just to use mapper functions, is superflous, we expose them through the Component module of the shopware object:

import { Component } from 'src/core/shopware';

/* the object spread is for less typing only
const { mapState } = Component.getComponentHelper();

Component.register('new-component', {
    computed: {
        ...mapState(['state', 'ohterState'])
    }
});

Sorry for letting you wait and i hope this is helpful.

1 „Gefällt mir“