build-electron
build-electron copied to clipboard
You should consider ncc
https://github.com/vercel/ncc and deprecate this
It's not obvious how to use ncc with electron. They don't even mention it in their doc. Also it seems that it does not even work with electron, because you cannot change the output file name or am I missing something?
@mifi no need to change anything ncc simply really creates a single file bundle of nodejs projects so if you got mixed cjs esm source and node modules it creates a single file from your nodejs entrypoint and that can be used in your nwjs/electron app to offer all modules.
I mean it doesnt support customizing output file name, so if you have main.js and preload.js it will output the same name index.js for both, which will overwrite (see the issue i linked)
@mifi https://www.npmjs.com/package/@vercel/ncc look at the option asset builds i guess thats the solution
I'm not sure how that option can be used to build files separately for the electron preload target and main target, do you have any example?