Closed automationghost closed 4 months ago
hey there @automationghost, do you have a repo to share?
alternatively: i’ve recently revamped the boilerplates and provided scripts to get them:
react
npx degit vitordino/reduxtron/packages/boilerplate-react project-name
svelte
npx degit vitordino/reduxtron/packages/boilerplate-svelte project-name
vue
npx degit vitordino/reduxtron/packages/boilerplate-vue project-name
vanilla
npx degit vitordino/reduxtron/packages/boilerplate-vanilla project-name
they might help with this initial proof of concept (:
This is the boilerplate.
https://github.com/cawa-93/vite-electron-builder
maybe you can take a quick look on the ts configs and tell me what your aproach would be. I think its mainly about the
"moduleResolution": "Node",
settings ...
I tried changing it to nodenext as you have it .. but then it breaks some of their stuff :D...
You could basically install taht boilerpalte and try to install the mainbridge to see the problem
the configs are in the packages folders
i won’t be able to check this until next week.. hold tight..
i won’t be able to check this until next week.. hold tight..
ok no worries . I will try buidling a variation of electron-redux with persiting the state via a json file until then .
I would like to try both your version and mine see how it goes . Maybe I use both. The automationghost app will have a heavy focus on windows creations .. so im currently dabbling alot with this to see what works best.
have a nice weekend
I spent whole day re-creating my own version of redux-electron.
damn my brain is fried after this ipc pingpong :D .... but it works.
I used redux persists with electron store for the main process and for the renderer process i use normal redux without persist but forward all actions to main . Main then updates all renderer windows...
I have 2 middlewares forwardToMain forwardToRenderer
utility functions : setupPreload() initilizeRendererListeners intilizeMainlistener
i can plug initilizeRendererListeners to any new window I create so pretty convienent.
and i can debug with redux extension in the frontend ... strangely though i havent figured out how to connect to the mainprocesses redux store with the redux chrome extension... doesnt seem to work for some reason... (event though i use the redux toolkit devtools option ... cant connect to the store .... anyway :D ... just sharing my excitement and pain :D ... have a nice day
i have found the problem >
the npm package seems to have a problem with the dist folder so the import statement is wrong :)
though i checked your package.json ... guess all is setup correcetly there .. still not sure whats going on :D
import { mainReduxBridge } from "reduxtron/main"; import { mainReduxBridge } from "reduxtron/dist/main"; <<works
i leave it to you
this might help: https://github.com/vitordino/vite-electron-builder-reduxtron
i couldn’t find a perfect way to make both typescript and the bundler happy that quick..
so i did the age old trick of using patch-package
, and left only the typescript source to be imported
i’ve also noticed that although it claims:
Written following the latest safety requirements, recommendations and best practices.
looks like any exposed preload
work if you set BrowserWindow
to webPreferences.sandbox: false
with the standard configuration
on a personal note:
i didn’t liked that much the way this boilerplate deals with some details..
the biggest one is how they rely on some preload
magic* that might make it harder to use some electron packages
the magic is that unplugin-auto-expose
..
Thanks . I will give it a go some sometime. So far im fine with this boilerplate. this one loads much faster thanks to vite and it looks like for now it will be easy to update electron versions which was a problem with the other boilerplate.
looking at vscode repo for inspiration. I want to build a extension system as a final goal down the road ... just researching takes me hours at the moment .. but its good fun.
Thanks again.
alright, let me know if you need anything else
Greetings I cant import main mainReduxBridge in my project . ( also cant import preloadReduxBridge )
im using electron-vite-builder and the tsconfig there seems to cause the issue
I dont want to mess with their config ... so im not sure what to do :)
im currently debating if I build my own solution for handling state across multiple windows ...
already fiddled around abit . handling the state in the main process seemed like a good solution for me ... also I would need to persist the data and be able to debug / connect to the redux store ...
Previously I expermented with having a renderer store only .. but it got abit messy sharing the the state .. as there is no single source of truth .. still found a solution to that .. but wasnt happy ... so i ended up looking into other solutions ... electron-redux didnt seem to work with preload script / context isolation .. and reduxtron gave me trouble with import ... yeah :)