Stumbled upon this article on how the Zeit team integrated Nex with Electron:
One consideration they mention is not to open a port in production due to security vulnerabilities:
The reason why electron-next doesn't have the same behaviour in the final app as in development is that opening a port (like Next.js does it for providing hot reloading and auto-building of your code) is generally not a good idea because it introduces a security vulnerability on the user's device.
It's therefore safe for development, but not for production.
What's much safer, however, is letting the BrowserWindow instances directly access the static files of your renderer. This is made possible by next export, a new sub command that we've introduced with Next.js 3
next export is equivalent to running nuxt in
--spa mode. So perhaps similar considerations can be applied to this template