When working with Vue 2/3 and in an ES6 environment, I often access a Vuex store in an external JS file using the following method:
// example.js
import { store } from '../store/index';
console.log(store.state.currentUser);
While this method works well, in my current setup (Rails 5 without webpack), I am unable to use import
statements.
Question: Is there a way to access Vuex stores outside of components using regular ES5 JavaScript?
I have successfully set up Vuex on our frontend, but we are facing limitations in accessing it outside of defined Vue components.