Tools Tips: How to set up hot reload on Electron

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


When working on an Electron app, it’s very handy to set up hot reload, so that the application updates without having to restart it.

You can do that using the npm module electron-reloader.

Suppose you have this sample Electron application:

index.js

const { app, BrowserWindow } = require('electron')

function createWindow() {
  // Create the browser window.
  const win = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true,
    },
  })

  // and load the index.html of the app.
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Hello World!</title>
  </head>
  <body>
    <h1>Hello World!</h1>
  </body>
</html>

Install electron-reloader as a development dependency:

npm install -D electron-reloader

Then add this line to the index.js file:

try {
  require('electron-reloader')(module)
} catch (_) {}

and that’s it! Now when you start the application using electron ., or npm start if you have

"start": "electron .",

in your package.json, any change you apply to the application files will be reflected in the application window.

Lessons in this unit:

0: Introduction
1: How to fix the ffmpeg not found error with youtube-dl
2: ▶︎ How to set up hot reload on Electron
3: How to disable 1Password in an input field
4: How to recover lost data from an SD card
5: Pasting code snippets in Discord
6: Remove EXIF data from images
7: Searching for the perfect e-ink writing device
8: Syntax highlight any block on a Web Page
9: What is a webhook?
10: What's the best platform to deploy your projects?
11: Scraping with Puppeteer
12: Why use a preview version of a browser?
13: A practical guide to Homebrew
14: How to fix the xcrun invalid active developer path error in macOS