Deluze / electron-vue-template

Simple Vue3 + Electron starter template in TypeScript, including ViteJS and Electron Builder
MIT License
534 stars 104 forks source link

copy static files of main in building process #14

Closed zhanglongqi closed 2 years ago

Deluze commented 2 years ago

Why this change?

Electron Builder pulls the static files directly from the src dir when the app gets compiled.

This change would allow you to run electron through command line on the build dir, I'm wondering why someone would prefer that instead of running the run dev command.

zhanglongqi commented 2 years ago

sorry, the modification should be in dev-server.js I add this because I need to access the image file in the main process.

Deluze commented 2 years ago

I just noticed. You're correct, this broke after we migrated to TS.

I don't think there's a way to avoid this right? I'm thinking about the devs that have larger files in their static directory, it would need to get copied on every start up.

I'll test your change and if everything works perfectly I'll merge it 👍

Deluze commented 2 years ago

Looks good, one thing I noticed is that the cpSync method got introduced in 16.x, so the minimum version of node should be in order to use this template is 16.x now.

Not a problem for me 😄 seems that node LTS is currently on 16.x. Nice!

Thank you for contributing. It means a lot.