question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How should electron build be handled?

See original GitHub issue

I noticed in the package.json there does not seem to be any reference to actually packaging up electron builds for distribution.

I am currently trying to wire something up using electron-builder but wondered if there was something I was missing?

Cheers.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
egoistcommented, Feb 23, 2017

You can use electron-builder, maybe we should add it to package.json later

0reactions
adrianrudnikcommented, Apr 25, 2017

Pretty new to this stuff, is there any sample flow/package.json to for the app directory on how to compile a working app with electron-builder? Edit, got it working, though I’m not sure this would be the correct way:

app/package.json
{
  "name": "x",
  "version": "0.0.0",
  "author": "x",
  "description": "x",
  "devDependencies": {
    "cross-env": "^4.0.0",
    "electron-builder": "^17.0.3",
    "electron-prebuilt": "^1.4.13"
  },
  "build": {
    "appId": "xyz",
    "directories": {
      "output": "output"
    }
  },
  "scripts": {
    "clean": "rm -rf ./dist/linux-unpacked && rm -rf ./output",
    "build": "touch .env.prod && cross-env NODE_ENV=production build && rm .env.prod"
  },
  "main": "index.js",
  "files": [
    "dist/*.js",
    "dist/*.html",
    "dist/*.css"
  ]
}

Also a small change to the app/index.js so isDev is resolved differently for the elctron build:

const fs = require('fs')
if (fs.existsSync('.env.prod')) {
  process.env.NODE_ENV = 'production'
}

const isDev = process.env.NODE_ENV === 'development'

now a npm run build in the app directoy produces a valid and running AppImage in the app/output directoy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Configuration - electron-builder
Common Configuration. electron-builder configuration can be defined. in the package.json file of your project using the build key on the top level:.
Read more >
A Comprehensive Guide to Building and Packaging an ...
Before you can package an Electron app, you first must build one. ... There is a secure way to handle communicating with your...
Read more >
Electron Build Desktop Apps HTML\CSS\JS - Medium
In this tutorial we are going to cover the build and deployment of your Electron App, using a third party library electron-builder which...
Read more >
Build Instructions | Electron
Follow the guidelines below for building Electron itself, for the purposes of creating custom Electron binaries. For bundling and distributing your app code ......
Read more >
An Introduction to Building Desktop Applications with Electron
The Main process is responsible for creating web pages. It does this by creating a new instance of the Electron.js BrowserWindow object. This ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found