frankhale / electron-with-express

A simple app that demonstrates spawning an Express app from Electron
MIT License
643 stars 147 forks source link

How to build using electron-builder #14

Closed isurendrasingh closed 5 years ago

isurendrasingh commented 5 years ago

How to use electron-builder to pack this app because using electron-packager there is a folder which contains all the code extracted from the asar. But using electron-builder there is only one package *.asar. Please provide details on how to pack with electron-builder.

frankhale commented 5 years ago

See https://github.com/frankhale/electron-with-express/issues/9 for info on how to make electron-builder work.

frankhale commented 5 years ago

https://github.com/frankhale/electron-with-express/issues/9#issuecomment-363870003

frankhale commented 5 years ago

Yeah I know that issue is for electron-packager but it's also using a single ASAR file. Basically you don't use the external node process like the others. You replace that with Electron and start up Electron in it's node mode (no UI). The instructions in comment 9 pasted above should work.

isurendrasingh commented 5 years ago

I tried what you said but getting this error

module.js:545 
throw err; 
^ 

Error: Cannot find module 'http-errors' 
at Function.Module._resolveFilename (module.js:543:15) 
at Function.Module._load (module.js:473:25) 
at Module.require (module.js:586:17) 
at require (internal/module.js:11:18) 
at Object. (C:\Users\Surendra\AppData\Local\Programs\Creast\resources\app.asar\express-app\app.js:1:174) 
at Object. (C:\Users\Surendra\AppData\Local\Programs\Creast\resources\app.asar\express-app\app.js:56:3) 
at Module._compile (module.js:642:30) 
at Object.Module._extensions..js (module.js:653:10) 
at Module.load (module.js:561:32) 
at tryModuleLoad (module.js:504:12) 

And when using electron-packager no errors

frankhale commented 5 years ago

To be honest electron-builder and electron-packager are beyond the scope of this project. This is a demonstration project which demonstrates one way to do things and the assumption at the time and still even now is that all files will be on the file system and not packaged into an .asar. I never liked the .asar approach as it complicates things and some things simply won't work.

That said I did help out on the electron-packager scenario but I don't know if I have the interest or time to devote to electron-builder as it's not something I use.

I'm going to close this for now. If somebody in the community wants to provide some information on how to do this I'd be more than happy to get a pull request with that information.