Our Electron app uses convert from ImageMagick, and that needs some .xml files alongside the binary. Our electron folder ends up looking like this:
public/
โโโ external/
โย ย โโโ colors.xml
โย ย โโโ convert
โย ย โโโ delegates.xml
โย ย โโโ magic.xml
โโโ app.css
โโโ app.js
โโโ electron-main.js
โโโ index.html
โโโ package.json
โโโ vendor.js
I'm able to run asar pack public/ public.asar --unpack 'public/external/*' and get both public.asar and public.asar.unpacked, but I cannot for the life of me figure out the path to be passed via build.asar-unpack in the development package.json.
I've tried ...
"build": {
"asar-unpack": "public/external/*"
}
"build": {
"asar-unpack": "external/*"
}
"build": {
"asar-unpack": "app/external/*"
}
"build": {
"asar-unpack": "*/external/*"
}
"build": {
"asar-unpack": "dist/ProductName-darwin-x64/Electron.app/Contents/Resources/app/external/*"
}
... But am not able to get app.asar.unpacked. Is there anything I'm missing?
Ah, figured it out. Using a globstar works, and no matter your directory structure, your files will be under app/. The following works:
"build": {
"asar-unpack": "**/app/external/*"
}
It is the shame because we inherit this configuration option from the electron-packager. So, it is not smart and not user-friendly and no any checks :( So sad :( We will rework and introduce new smart option.
Fixed โ now we correctly set cwdfor glob and relative patterns work. (it was bug in the asar).
Also you can use extraResources .
Please note asar-unpack is deprecated, use asar as object of options.
Thank you @mikew for also sharing your answer. In 2018 this worked:
"mac": {
...
"target": "dmg",
"asar": true,
"asarUnpack": [
"../node_modules/@ffmpeg-installer"
]
}
Successfully get this once the _dmg_ is installed:
contents/
โโโ Resources/
โ โโโ app.asar
โ โโโ app.asar.unpacked/
โ โโโ node_modules/
โ โโโ @ffmpeg-installer/
Now the tricky part is referring to it from within your app :trollface:
This hazardous workaround seems to work with basically 1 line of code: https://github.com/electron/electron/issues/6262#issuecomment-273312942
I have this problem:

I tried this and it didn't work
js
"asar": true,
"asarUnpack": ["../node_modules/sqlite3"],
any idea?
@challenger532 try changing:
"asarUnpack": ["../node_modules/sqlite3"],
to
"asarUnpack": ["node_modules/sqlite3"],
Most helpful comment
Thank you @mikew for also sharing your answer. In 2018 this worked:
Successfully get this once the _dmg_ is installed:
Now the tricky part is referring to it from within your app :trollface:
This
hazardousworkaround seems to work with basically 1 line of code: https://github.com/electron/electron/issues/6262#issuecomment-273312942