2

I have an electron app and use electron-packager for creating an executable that is used for a couple of days when the app is used. In my package.json it looks like this:

{
"name": "Software",
"version": "0.1.0",
"main": "main.js",
"devDependencies": {
  "electron": "^6.0.9",
  "electron-packager": "^14.0.6"
},
"dependencies": {
  "chart.js": "2.8.0",
  "deep-equal": "^1.1.0",
  ...
},
"scripts": {
  "start": "electron .",
  "pack-win": "electron-packager . Software --overwrite --asar --platform=win32 --arch=x64 --prune=true --out=dist",
  "pack-linux": "electron-packager . Software --overwrite --asar --platform=linux --arch=x64 --prune=true --out=dist"
 }

That works really fine, but I'd also like to minify my code automatically before packaging (without changing the original files of course), so that npm run pack-win minifies the code and then directly builds my distribution version.

Does anybody know how I can achieve this?

Torf
  • 1,154
  • 11
  • 29
  • Have you found a solution for your minify before or while packaging task? – dufte Nov 22 '19 at 09:45
  • Not now. Looks like using `electron-packager` not via script in package.json but instead programmatically could do the trick. There are hooks for `afterPrune` and `afterCopy`. But I did not have the time to try it. – Torf Nov 23 '19 at 08:42

0 Answers0