Electron project with Typescript and hot reload


#1

Does anyone have a sample Electron project I can use? I want to code in TypeScript and also have hot reload support built in, but I don’t want React. electron-forge has a React + TypeScript template (https://electronforge.io/templates) but I’m not sure how to rip out the React part and still keep the hot reloading piece in.


#2

Removing React is the easiest thing in the world. Just go into the src/index.html and src/app.tsx files and delete everything that references react, then replace with your own code. However, the hot loader built into that template is react-hot-loader, so if you remove React, you can’t keep the reloading.


#3

actually, I think I just figured out how to enable hot reload. I just needed to include and call the following:

import { enableLiveReload } from 'electron-compile';
enableLiveReload();