This is a boiler plate starter pack when starting an electron project which uses react with typescript. The code contains some bug fixes that are found when using react with electron and typescript and has auto monitoring of typescript changes to reload the electron app for faster development.
- Run electron app with create-react-app without ejecting.
- Auto reloads the electron app when the typescript source file changes. (This is missing in a lot of tutorial articles which only have an electron.js file and not a electron.ts file )
- Provides the required npm scripts and folder structure for simple to complex projects.
- Includes a very simple bundling process.
- Auto reloads app for changes in both main process files and react files.
- With the provided folder structure , main and renderer process codebase can be maintained independently.
cd renderer
npm install // First time only
npm run start
cd main
npm install // First time only
npm run start
- Just make sure that you have added all the dependencies in the
main/package.json
to therenderer/package.json
and the run the below command from therenderer
folder.
cd renderer
npm run release // or npm run build
Sit back and have a cup of Coffee while the app gets built .
You will now have a full fledged application waiting for you in the dist
folder.
- If your app uses React Router , make sure you use
HashRouter
instead ofBrowserRouter
. - In the
renderer/package.json
, use thebuild
property to modify the settings for electron-builder. All assets and static files in your project should be present in theassets
folder. - To get different installer types like 'msi' , 'appx' , '7z' , 'zip' etc , change the
target
property inside thebuild
property inrenderer/package.json
. - If you have nested structure of typescript files in the
main
folder , make sure that you copy all the generated javascript.js
files into therenderer/public/
folder before building the react app (This would add the javascript files in the public folder into the build folder when building our react-app).