I'm building an Electron application starting from the electron-webpack
boilerplate.
I found this node module @ffmpeg-installer/ffmpeg
which installs a compatible precompiled binary into the /node_modules
directory then makes the path of that executable accessible through.
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path
This works fine during development, but when I build the distributable and run it I get an error when attempting to spawn a child process with that path. Presumably, because the path does not point at the binary.
The path is set to the following when running the distributable.
/Users/me/project/dist/mac/AppName.app/Contents/Resources/app.asar/node_modules/@ffmpeg-installer/darwin-x64/ffmpeg
However, when looking in the AppName.app
package contents I find the binary in the following path.
/Users/me/project/dist/mac/AppName.app/Contents/Resources/app.asar.unpacked/node_modules/@ffmpeg-installer/darwin-x64/ffmpeg
How should I include binary dependencies in an Electron application using electron-webpack
and electron-builder
?
asarUnpack
option? – Bartholomeus