U
U
undefined2020-09-01 13:32:57
JavaScript
undefined, 2020-09-01 13:32:57

How to add Vuex to background.js file, do Chrome Extension?

The bottom line is, I'm making a Chrome Extension, and I have a browser folder in src, manifest.json and background.js are there, they go to dist/ during assembly through vue.config.js, so I need to use Vuex in background.js , but when I import store from '../store' into this file, then the chrome.contextMenus.onClicked event disappears, which should display alert(store.state.hello), but what's interesting is when I look into the collapsed background.js then it has this store that is imported, I think this is a builder problem or something like that.

Confirmation that the background.js store is present:
5f4e226a93cb0407986552.jpeg

This is when the Vuex store is in the alert:
5f4e22841d44d842842082.jpeg
5f4e229bf3023084398943.jpeg

This is when the alert is just a word:
5f4e22b074e33362408510.jpeg
5f4e22c1784cd433968690.jpeg

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question