Express port not accessible when packaging app


#1

I have an express server running within my Electron app that’s require’d in the main.js file. It runs fine (on port 10010) when I run electron in dev mode (via electron forge). When I compile for my mac, the app runs fine, but the ports are no longer available. Is electron doing something to block ports exposed by express?

I tried running express agains different ENV variables to see if I had something misconfigured there, but everything works as expected when running externally from electron or in electron dev mode. Again, this works fine if I run electron ., it only fails to work when I build for a particular target- I don’t get any errors, the resource just isn’t accessible.

I understand many people think it’s a terrible architecture having an express server in their app, but I have a very compelling reason to have one. Hoping for some suggestions.