build-electron icon indicating copy to clipboard operation
build-electron copied to clipboard

You should consider ncc

Open frank-dspeed opened this issue 3 years ago • 5 comments

https://github.com/vercel/ncc and deprecate this

frank-dspeed avatar Jan 29 '22 07:01 frank-dspeed

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 avatar Jan 29 '22 09:01 mifi

@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.

frank-dspeed avatar Jan 29 '22 11:01 frank-dspeed

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 avatar Jan 29 '22 11:01 mifi

@mifi https://www.npmjs.com/package/@vercel/ncc look at the option asset builds i guess thats the solution

frank-dspeed avatar Jan 30 '22 13:01 frank-dspeed

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?

mifi avatar Jan 30 '22 14:01 mifi