A simple electron and react setup with parcel instead of webpack
- Install Yeoman Globally
npm install -g yo
- Install Electron Globally
npm install -g electron
- Install Simple-React-Electron globally
npm install -g simple-react-electron
- Create a new folder
mkdir new-folder
- Go into the new folder
cd new-folder
- Run Simple-React-Electron
yo simple-react-electron
- Open new terminal and start parcelJS
npm run dev
- Open another new terminal and start electronJS
npm start
- Make your changes and reload the electronJS window
- Go into
main.js
and replacewin.loadURL('http://localhost:1234')
with
win.loadURL(url.format({
pathname: path.join(__dirname, 'build/distribute/index.html'),
protocol: 'file:',
slashes: true
}))
- Comment out
win.webContents.openDevTools()
- Build with parcelJS
npm run build
- Built files are in
build/distribute
- Clone Project
git clone https://github.com/sidnand/Generator-Simple-React-Electron.git
- Go into the project
Generator-Simple-React-Electron
- Run parcelJS
npm run dev
- Run electronJS
npm start