Their is a new post about this will full setup. check it here: https://dev.to/brojenuel/vue-3-vite-typescript-electron-my-full-setup-kgm
A lot o...
For further actions, you may consider blocking this person and/or reporting abuse
very nice tutorial
Thanks mate :)
Thank you for your tutorial!:)
It helped me to configure dev environment for electron, though I'm not using ts😁
awesome! Glad to help :)
don't work!
(node:4232) electron: Failed to load URL: localhost:3000/ with error: ERR_CONNECTION_REFUSED
(Use
electron --trace-warnings ...
to show where the warning was created)vite is not running after 'npm run electron'
I redid what I wrote above, but still works... try re reading the instruction above,, specially the script in package.json
This problem might be because vite port does not listen in port 3000 of local host. For fix it, see which port is vite running, and then, put it in the main.ts file
I got stuck on this one too, here is how I got through:
Or use two separate terminal and run
pnpm vite and pnpm dev:electron
"from the article"
Tanks! But i get some problem and could you help me?
With the demo i can run Vue3 + Vite in Electron but i can't use electron in xxx.vue
The code i write is copy what you write, the Demo.vue is what i write.
There is some details that changed on vite seems the creation of this post. You have to make some adjusts:
The main.js and preload.js file that controls electron shoud have now the extension cjs, so they should be renamed to main.cjs and preload.cjs because vite uses ES6 and this files don't.
I had some troubles to make it work. Your article really helped me, the app is created with success!
However, I see in VS Code that both in
electron.js
andpreload.js
I have some errors, because the following are not defined:require
,process
,__dirname
. Do you know a way to fix the problem? Or it's just a clashing configuration fromtsconfig.json
?Thanks!
It would be nicer if Electron itself is TypeScript as well.
You can actually change it to typescript if you want.
As soon as I am trying to use IPC I have an __dirname is not defined in the web console, any solutions ?
This video might help,,, its better to use something like context bridge in our preloadjs to create apis for our frontend. It is recommended by the electron documentation..
https://www.youtube.com/watch?v=h9rSUxZkEQw&list=PLwlbj033Wc51ZwPQx3bYO1eb2PProKgBX&index=6&t=617s
Thanks a lot, it worked !
Unfortunately, your tutorial whilst uses TS for the renderer, your main process code is only in JS. Anyone who's writing a desktop app would want TS for both renderer and main process. How to use TS for this and using module aliases?
It worked perfectly. Thanks!
Im Glad I could help :)
How can i use ES6 module in this project?
I have tried to add "type": "module" to package.json, but it didn't work.
I took a moment to sign up for this website to say thank you.
I followed your steps and it worked very well.
Thank you
Amazing work!!