Publish React app with electron

To publish a React app with Electron, you will need to first create a new React app using the create-react-app command. This will generate a new directory with the necessary files for a basic React app. Next, you will need to install Electron and the electron-builder package, which will allow you to build and package your app for publishing.

Once you have installed these dependencies, you can add a new script to your package.json file to build your app for publishing. This script should use the electron-builder command to build your app and package it for the appropriate platform (e.g. Windows, macOS, Linux).

After building your app, you can publish it using the appropriate method for the platform you built it for. For example, if you built a Windows app, you can publish it to the Microsoft Store. If you built a macOS app, you can publish it to the Mac App Store.

Here is an example of what your package.json file might look like after adding the necessary scripts:

  "name": "my-electron-app",
  "version": "1.0.0",
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "publish-windows": "electron-builder -w",
    "publish-macos": "electron-builder -m"
  "dependencies": {
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.3"
  "devDependencies": {
    "electron": "^10.1.1",
    "electron-builder": "^22.7.0"

To build and publish your app, you can simply run the appropriate script from the command line. For example, to build and publish a Windows app, you would run the following command:

npm run publish-windows

This will build your app and package it for publishing to the Microsoft Store. You can then follow the appropriate steps to publish your app to the store.

Edit this page on GitHub Updated at Thu, Dec 15, 2022