https://www.npmjs.com/package/electron-react-boilerplate
Electron application boilerplate based on React,React Router,Webpack,React Hot Loader for rapid application development
Live editing development on desktop app
Electronapplication boilerplate based onReact,Redux,React Router,Webpack,React Transform HMRfor rapid application development
Screenshot
Install
First,clone the repo via git:
And then install dependencies.
Run
Run this two commandssimultaneouslyin different console tabs.
or run two servers with one command
Note: requires a node version >= 4 and an npm version >= 2.
DevTools
Toggle Chrome DevTools
- OS X: Cmd Alt I or F12
- Linux: Ctrl Shift I or F12
- Windows: Ctrl Shift I or F12
Seeelectron-debugfor more information.
Toggle Redux DevTools
- All platforms: Ctrl+H
Seeredux-devtools-dock-monitorfor more information.
Redux Devtools Window
Now you can implement it usingremote-redux-devtoolswith aremote monitorby yourself.
Externals
If you use any 3rd party libraries which can't be built with webpack,you must list them in yourwebpack.config.base.js
:
You can find those lines in the file.
CSS Modules
This boilerplate out of the Box is configured to usecss-modules.
All.css
file extensions will use css-modules unless it has.global.css
.
If you need global styles,stylesheets with.global.css
will not go through the css-modules loader. e.g.app.global.css
Package
To package apps for all platforms:
Options
- --name,-n: Application name (default: ElectronReact)
- --version,-v: Electron version (default: latest version)
- --asar,-a:asarsupport (default: false)
- --icon,-i: Application icon
- --all: pack for all platforms
Useelectron-packager
to pack your app with--all
options for darwin (osx),linux and win32 (windows) platform. After build,you will find them inrelease
folder. Otherwise,you will only find one for your os.
test
,tools
,245);">releasefolder and devDependencies inpackage.json
will be ignored by default.
Default Ignore modules
We add some module'speerDependencies
to ignore option as default for application size reduction.
-
babel-core
is required bybabel-loader
and its size is ~19 MB -
node-libs-browser
is required bywebpack
and its size is ~3MB.
Note:If you want to use any above modules in runtime,for example:
require('babel/register')
,you should move them fromdevDependencies
todependencies
.
Building windows apps from non-windows platforms
Please checkoutBuilding windows apps from non-windows platforms.
How hot-reloading works on Electron
We usewebpack-target-electron-rendererto provide a build target for electron renderer process. Read more informationhere.
Note: webpack >= 1.12.15 has built-in support for
electron-main
andelectron-renderer
targets.
Native-like UI
If you want to have native-like User Interface (OS X El Capitan and Windows 10),react-desktopmay perfect suit for you.
Maintainers
License
MIT ©C. T. Lin