🚀 Yet another opinionated setup for Electron application
- Core setup from the original playgrounds.
- Clean and minimal setup to build React based Electron app with
webpack
andnext.js
. - Live-reloading (hot) works on both
main
andrenderer
processes. - Package executable app via
electron-builder
.
$ git clone https://github.com/preco21/electron-playgrounds.git
$ cd electron-playgrounds
$ npm install
Prerequisite: Node.js 8 or higher.
Note: If you are on Windows Subsystem for Linux, make sure you have set the proper environment variable before installing to let electron to use right binary for the platform: npm_config_platform=win32
.
This command will run internal script to provide live-reloading for main
process. After that, main
process will run electron-next
to serve renderer
process.
$ npm run dev
When the dev server has started, you can start editing components in pages
folder. Also you can edit index.js
for main
process. Any changes made within main
and src
folder will trigger live-reload automatically.
This command will bundle the sources to app
folder with webpack
and next.js
.
$ npm run build
After building, you will be able to run app as a standalone on the fly:
$ npm start
This command will package app with electron-builder
and this will generate the executable binaries in build
folder:
$ npm run package
This executable binaries is available to run without any runtime dependencies.
This command will remove any content inside the output directory which made by build
command.
$ npm run clean