vue-electron / vuex-electron

Integration of Vuex and Electron
MIT License
305 stars 96 forks source link

Type error if using vue-cli without proper webpack config #11

Closed ztoben closed 5 years ago

ztoben commented 5 years ago

You may want to consider updating the readme to cover an error I was running into. Even though it's not caused by this package, it may be helpful for troubleshooting.

I had bootstrapped my project with vue-cli and was seeing this error after adding the createPersistedState to my store:

TypeError: fs.existsSync is not a function at getElectronPath

I believe this is caused by referencing electron outside of the main.js file.

I fixed it by adding this to my vue.config.js in order to set my target properly:

configureWebpack: config => {
  config.target = "electron-renderer";
}
akodkod commented 5 years ago

https://github.com/vue-electron/vuex-electron/issues/44