spa5k / nextjs_approuter_electron

This is a template for building Electron apps with Next.js App router, SSR and Server Components
https://www.saybackend.com/blog/03-electron-nextjs-ssr
46 stars 4 forks source link

Question: dev mode, simplicity #5

Closed nandorojo closed 1 month ago

nandorojo commented 1 month ago

Hey! Thanks so much for publishing this.

Quick questions:

  1. Readme states "Electron expects that you have already created production output of the NextJS app"

How could we make this support local dev mode/HMR? I'm trying to get that spun up. Should that work with make web dev?

  1. Is it necessary to even copy the files? Couldn't startServer just get the path to ../web directly without copying any files?

  2. Calling make web dev throws this error for me. I wonder if there might be a simpler script that could do it.

I'll be poking around to see if I can address these things, so I wanted to share them first. Thank you!

Screenshot 2024-07-25 at 7 26 21 AM
nandorojo commented 1 month ago

For dev mode, I just called npm run dev in web and npm run dev in electron (in a separate terminal) and it worked fine.

Going to see if I can generally get rid of the file copying

spa5k commented 1 month ago

In dev mode, you don't need to copy or anything, you can just the electron and the Next.js server on another terminal. What I stated is for build time.

nandorojo commented 1 month ago

Yeah got it working now, makes sense, dev mode works fine for me. Thanks!

spa5k commented 1 month ago

@nandorojo now I've updated it to a normal repo, you don't need to copy when it comes to production mode anymore. It works directly and is much simpler.