I made a simple Electron app:
main.js
const {app, BrowserWindow} = require('electron')
const path = require('path')
const url = require('url')
let win
function createWindow () {
win = new BrowserWindow({
width: 800,
height: 600,
icon: path.join(__dirname, 'icon.ico')
})
win.maximize();
win.loadURL('https://stackoverflow.com/', {"extraHeaders" : "pragma: no-cache\n"});
win.on('closed', () => {
win = null
})
}
app.on('ready', createWindow)
app.on('browser-window-created',function(e,window) {
window.setMenu(null);
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (win === null) {
createWindow()
}
})
package.json
{
"name": "test",
"version": "1.0.0",
"main": "main.js",
"build": {
"appId": "com.test.app",
"copyright": "test",
"productName": "test"
},
"devDependencies": {
"electron": "1.7.9",
"electron-builder": "^19.46.4",
"electron-packager": "^10.1.0"
}
}
with electron-packager i have builded the package to release:
electron-packager . --overwrite --asar=true --platform=win32 --arch=ia32 --prune=true --out=release-builds
the total size of the builded package is 107 MB.
Anyone have tips to reduce the size of the package?