this boilerplate helped me tremendously with my first exploration into packaging a Next.js app with Electron. However, I always got an error when moving the App to a different location like desktop. (I'm using mac)
I think it has to do with path resolving of modules like sharp, which result in a fatal error if you are using the package in an API route or Server Action. I've done following changes to the setup to fix those issues:
Hey,
this boilerplate helped me tremendously with my first exploration into packaging a Next.js app with Electron. However, I always got an error when moving the App to a different location like desktop. (I'm using mac)
I think it has to do with path resolving of modules like
sharp
, which result in a fatal error if you are using the package in an API route or Server Action. I've done following changes to the setup to fix those issues:Change webdir path in main.js
Move extra_files to files:
Unpack next in
asarUnpack
:If you're using
sharp
:This also packages the Next export inside the
.asar
archive.Maybe this'll help someone else! :-)