Electron App takes a lot of time to Load


Electron version:0.37.2
Operating system:Windows
I have created an electron app as a wrapper of a website.
Below is the code:
Dev Package.json:
“devDependencies”: {
“electron-builder”: “^3.27.0”,
“electron-prebuilt”: “^0.37.2”
“build”: {
“app-bundle-id”: “EnterpriseSearch”,
“app-category-type”: “public.app-category.productivity”,
“win”: {
“iconUrl”: “http://eatodo.s3.amazonaws.com/icon.ico
“scripts”: {
“postinstall”: “install-app-deps”,
“start”: “electron ./app --enable-logging”,
“dev”: “NODE_ENV=‘development’ npm run start”,
“dist”: “npm run dist:win64”,
“dist:win64”: “build --platform win32 --arch x64”

Application Package.json:
“description”: “This is a desktop app for Enterprise Search.”

if (require(‘electron-squirrel-startup’)) return;
var app = require(‘app’);
// this should be placed at top of main.js to handle setup events quickly
if (handleSquirrelEvent()) {
// squirrel event handled and app will exit in 1000ms, so don’t do anything else

function handleSquirrelEvent() {
if (process.argv.length === 1) {
return false;

const ChildProcess = require(‘child_process’);
const path = require(‘path’);

const appFolder = path.resolve(process.execPath, ‘…’);
const rootAtomFolder = path.resolve(appFolder, ‘…’);
const updateDotExe = path.resolve(path.join(rootAtomFolder, ‘Update.exe’));
const exeName = path.basename(process.execPath);

const spawn = function(command, args) {
let spawnedProcess, error;

try {
spawnedProcess = ChildProcess.spawn(command, args, {detached: true});
} catch (error) {}

return spawnedProcess;

const spawnUpdate = function(args) {
return spawn(updateDotExe, args);

const squirrelEvent = process.argv[1];
switch (squirrelEvent) {
case ‘–squirrel-install’:
case ‘–squirrel-updated’:
// Optionally do things such as:
// - Add your .exe to the PATH
// - Write to the registry for things like file associations and
// explorer context menus

// Install desktop and start menu shortcuts
spawnUpdate([’–createShortcut’, exeName]);

setTimeout(app.quit, 1000);
return true;

case ‘–squirrel-uninstall’:
// Undo anything you did in the --squirrel-install and
// --squirrel-updated handlers

// Remove desktop and start menu shortcuts
spawnUpdate([’–removeShortcut’, exeName]);

setTimeout(app.quit, 1000);
return true;

case ‘–squirrel-obsolete’:
// This is called on the outgoing version of your app before
// we update to the new version - it’s the opposite of
// --squirrel-updated

return true;

var BrowserWindow = require(‘browser-window’);

var win = null;

app.on(‘ready’, function() {
win = new BrowserWindow({webPreferences: { nodeIntegration: false}});


win.on(‘closed’, () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;

// Quit when all windows are closed.
app.on(‘window-all-closed’, () => {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== ‘darwin’) {

I have build the installer using electron builder.
But final exe takes around 1 minute to load and display the page.
How can I improve it’s performance.


I’m not in a position to help you with your performance issues, but please consider fencing your code with backticks as described here. It would make it much easier to read for the people with the ability to assist you.


Oh…Sure. Will remember this next time. is there any suggestion on Electron app performance?


My App takes around 1 minute to load. is it the expected time to load an electron app?


When you say ‘load’, where are you loading from? Is it via command line or have you packaged the app?

My app is instant from command line and only takes a couple of seconds, once packaged, to install and start up.


oh…That’s great. I am loading from installer, final exe built from electron - builder. When I click it takes around one minute to load. Have you done any specific setting to reduce load time?


How long does your unpackaged app take to load? Regardless, you need to profile your app to see where all that time is going, there’s no point trying to guess.


Can you edit your original post with the backticks ( ` ) so you can get more help?


@enlight… Un packaged also take almost same time. Even electron demo app also takes similar time. Any idea why?
@sargasdev - I am able to edit the subject, but not the description.


If you click the ellipsis button:

Then you get a bigger menu that includes the option to edit the body text of your post: