electron-react-boilerplate

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

First,clone the repo via git:

 
   
gitclonehttps://github.com/chentsulin/electron-react-boilerplate.gityour-project-name

And then install dependencies.

$cdyour-project-name&&npminstall

Run this two commandssimultaneouslyin different console tabs.

$npmrunhot-server
$npmrunstart-hot

or run two servers with one command

$npmrundev

Note: requires a node version >= 4 and an npm version >= 2.

  • OS X: Cmd Alt I or F12
  • Linux: Ctrl Shift I or F12
  • Windows: Ctrl Shift I or F12

Seeelectron-debugfor more information.

  • All platforms: Ctrl+H

Seeredux-devtools-dock-monitorfor more information.

Now you can implement it usingremote-redux-devtoolswith aremote monitorby yourself.

If you use any 3rd party libraries which can't be built with webpack,you must list them in yourwebpack.config.base.js

externals:[
//putyournode3rdpartylibrarieswhichcan'tbebuiltwithwebpackhere(MysqL,mongodb,andsoon..)
]

You can find those lines in the file.

This boilerplate out of the Box is configured to usecss-modules.

All.cssfile extensions will use css-modules unless it has.global.css.

If you need global styles,stylesheets with.global.csswill not go through the css-modules loader. e.g.app.global.css

$npmrunpackage

To package apps for all platforms:

$npmrunpackage-all
  • --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-packagerto pack your app with--alloptions for darwin (osx),linux and win32 (windows) platform. After build,you will find them inreleasefolder. Otherwise,you will only find one for your os.

test,tools,245);">releasefolder and devDependencies inpackage.jsonwill be ignored by default.

We add some module'speerDependenciesto ignore option as default for application size reduction.

Note:If you want to use any above modules in runtime,for example:require('babel/register'),you should move them fromdevDependenciestodependencies.

Please checkoutBuilding windows apps from non-windows platforms.

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 forelectron-mainandelectron-renderertargets.

If you want to have native-like User Interface (OS X El Capitan and Windows 10),react-desktopmay perfect suit for you.

MIT ©C. T. Lin

相关文章

react 中的高阶组件主要是对于 hooks 之前的类组件来说的,如...
我们上一节了解了组件的更新机制,但是只是停留在表层上,例...
我们上一节了解了 react 的虚拟 dom 的格式,如何把虚拟 dom...
react 本身提供了克隆组件的方法,但是平时开发中可能很少使...
mobx 是一个简单可扩展的状态管理库,中文官网链接。小编在接...
我们在平常的开发中不可避免的会有很多列表渲染逻辑,在 pc ...