Reputation: 440
I am currently developing a simple Hello World app using Angular and Electron (following this guide: https://angularfirebase.com/lessons/desktop-apps-with-electron-and-angular/). The steps are very simple:
npm install electron --save-dev
;npm install electron-packager -g
and npm install electron-packager --save-dev
;npm run build && npm run electron
.However, even if the app is totally basic, i obtain a final folder of 275MB.
I understand that Electron requires the whole Chromium and NodeJS thing to work, but on https://github.com/electron/electron/issues/2003 and other pages i read that people manage to obtain packages of ~30MB or at least 100MB, which is still preferable to 275MB. Can someone help me and explain me how to do that?
In case you need it, this is my package.json:
{
"name": "app-test",
"version": "0.0.0",
"main": "main.js",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"electron": "electron .",
"electron-build": "npm run build && npm run electron"
},
"private": true,
"dependencies": {
"@angular/animations": "~8.2.14",
"@angular/common": "~8.2.14",
"@angular/compiler": "~8.2.14",
"@angular/core": "~8.2.14",
"@angular/forms": "~8.2.14",
"@angular/platform-browser": "~8.2.14",
"@angular/platform-browser-dynamic": "~8.2.14",
"@angular/router": "~8.2.14",
"rxjs": "~6.4.0",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.21",
"@angular/cli": "~8.3.21",
"@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~8.2.14",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"electron": "^7.1.8",
"electron-packager": "^14.1.1",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
}
Upvotes: 1
Views: 1303
Reputation: 159
If you add the --prod
tag to your build command, you should get a smaller folder size.
You can see more build tags that might help you here: https://angular.io/cli/build
Upvotes: 2