Package portable executables withe the pkg tool. To create executables for Linux and Windows use the script
npm run build:cliThis implies the
pkgis globally installed withnpm install -g pkg
Start the app in the dev environment:
npm startTo package apps for the local platform:
npm run packageApps Contents - https://www.electron.build/configuration/contents
- Extracting the app.asar archive
npx asar extract app.asar <destfolder>__dirnameis problematic in packaged mode, because the code for the main process is bundled as single file main.js (in webpack.config.main.prod.ts), and so when it is run the__dirnameis the same current oneapp.asar/dist/main. This is problematic for this project as the usedsource-mappackage loads a filemappings.wasmfrom its lib folder using__dirname.One way to get around this is to use the
source-map-jspackage which is a fork from thesource-mapbefore using Rust and WASM. The other way is to copy themappings.wasmfile in therelease/app/dist/mainbefore electron package. Done with anpmscriptcopy:source-map-wasm.