For example, I have a compiled binary cudaDeviceQuery
which returns a list of devices as JSON. Here\'s a piece of code:
export default function
Add this in package.json
:
"scripts": {
"start": "electron .", "install": "electron-rebuild",
"package-osx": "electron-packager . Node-RED --platform=darwin --arch=x64 -- out=build --overwrite",
"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --prune=true --out=release-builds",
"package-win": "electron-packager . electron-serialport --overwrite --asar=true --platform=win32 --arch=x64 --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"CryptoApp\"",
"package-linux": "electron-packager . electron-serialport --overwrite --asar=true --platform=linux --arch=x64 --prune=true --out=release-builds"
},
"dependencies": {
"electron-packager": "^12.1.0",
"electron-prebuilt": "^1.4.13",
}
In case of not working for windows use the following:
"package-win": "electron-packager . electron-serialport --overwrite --asar=true --platform=win32 --arch=ia32 --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"CryptoApp\"",
Thanks...
There are two things. If you set __dirname: true
in your web app config you will get the relative
path of the file from your context directory
If you set __dirname: false
then __dirname
will have the full path.
Development Mode
You have two options
__dirname: true
and concatenate it with os.cwd()
__dirname: false
and use __dirname
directlyProduction Mode
__dirname: true
and use os.cwd()
.__dirname: true
and use process.resourcePath
I will prefer 2 as the preferred approach in production