0
votes

I trying to build an Electron app. For that I'm using the following respos: https://github.com/electron/electron-quick-start https://github.com/electron-userland/electron-builder

In development mode (electron .) everything works fine. But when I build the app and starting it, it just loads pretty much the page, but it's datepicker from the node modules is missing, a without any errors in the dev console or build log.

Why doesn't it work in production? All my files are in one direction:

  • index.html
  • main.js
  • renderer.js
  • package.json

I didn't changed much in the base package.json file:

{
  "name": "twitter-dm-scheduler",
  "version": "1.0.0",
  "description": "TBD",
  "main": "main.js",
  "buildDependenciesFromSource": "true",
  "scripts": {
    "start": "electron .",
    "dist": "electron-builder",
    "pack": "electron-builder --dir",
    "postinstall": "electron-builder install-app-deps"
  },
  "author": "TBD",
  "license": "CC0-1.0",
  "devDependencies": {
    "electron": "^10.1.3",
    "electron-builder": "^22.8.1",
    "jquery": "^3.5.1",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.31",
    "popper.js": "^1.16.1",
    "zebra_datepicker": "^1.9.15"
  },
  "dependencies": {
    "bootstrap": "^4.5.2",
    "bulma-calendar": "^6.0.9",
    "electron-context-menu": "^2.3.0"
  },
  "build": {
    "appId": "com.electron.twitterdmscheduler",
    "productName": "Twitter DM Scheduler",
    "directories": {
      "output": "build"
    },
    "nsis": {
      "oneClick": true
    }
  }
}

1

1 Answers

0
votes
"devDependencies": {
    "electron": "^10.1.3",
    "electron-builder": "^22.8.1",
    "jquery": "^3.5.1",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.31",
    "popper.js": "^1.16.1",
    "zebra_datepicker": "^1.9.15"
  },

While packaging, the electron-builder won't pack the devDeps so you can't use this jquery, moment after packaging.

Move these deps to your dependencies