This is the example usage of electron-packager that I never found online anywhere else.
To add resource.exe and resource2.dll in the resource folder when you create an installer, this is how you do it with the --extra-resource commandline switch.
electron-packager . --overwrite --asar --extra-resource="resource1.exe" --extra-resource="resource2.dll" --platform=win32 --arch=ia32 --icon=./frontend/dist/assets/icon.ico --prune=true --out=./build --version-string.ProductName='Hot Pan de sal'
within the backend code you can refer to the files as:
"./resources/resource1.exe"
Thank you very much for this.
I had a sound effect in the assets folder. The assets folder was adjacent to
package.json
.I used
--extra-resource="assets/shutter.mp3"
inpackage.json
file. It adds the resource in the "resources" folder after packaging.For referring to this file in the code, I used:
const path = require('path'); const filePath = path.join(process.resourcesPath, "shutter.mp3");
Worked flawlessly.