Closed rafaberaldo closed 4 months ago
After playing a bit with @electron/packager
, I could use their afterCopy
hook to accomplish that.
Another option I can think of, would be using @electron/get
to download the distributed version and modify the files before electron-builder. Doesn't feel right though since electron-builder already does it.
Closing this as the PR has been merged.
I didn't test but using @electron/asar
probably breaks autoupdater from electron-builder
.
For those who's gonna look at this in the future, what I'm gonna do is use the afterExtract
hook to get the distributed node/electron and modify the files before they get packed.
Related: https://github.com/electron-userland/electron-builder/issues/5619
I need to modify some files before packing using the distributed node/electron, the problem is that I'm building it on a x64 machine and the distributable is x86 (meaning I can't just use
node_modules/electron
).beforePack
hook doesn't work because distributable electron hasn't been downloaded/unziped yet, andafterPack
already has the asar archive.I did find a solution using the
@electron/asar
package:asar: true
andasarUnpack: '**/*'
this is for electron-builder don't throw error saying the main.js doesn't exist.async function afterPack (context) { const fileName = context.packager.appInfo.productFilename; const binPath = path.join(context.appOutDir,
${fileName}.exe
);},