0

this is my first time building an electron app and I am getting confused about this error I got in my production package.

I've created my app using the electron-react-boilerplate, and I am running the package build with the default config.

  "build": {
    "productName": "App",
    "appId": "org.erb.ElectronReact",
    "asar": true,
    "asarUnpack": "**\\*.{node,dll}",
    "files": [
      "dist",
      "node_modules",
      "package.json"
    ],
    "afterSign": ".erb/scripts/notarize.js",
    "mac": {
      "target": {
        "target": "default",
        "arch": [
          "arm64",
          "x64"
        ]
      },
      "type": "distribution",
      "hardenedRuntime": true,
      "entitlements": "assets/entitlements.mac.plist",
      "entitlementsInherit": "assets/entitlements.mac.plist",
      "gatekeeperAssess": false
    },
    "dmg": {
      "contents": [
        {
          "x": 130,
          "y": 220
        },
        {
          "x": 410,
          "y": 220,
          "type": "link",
          "path": "/Applications"
        }
      ]
    },
    "win": {
      "target": [
        "nsis"
      ]
    },
    "linux": {
      "target": [
        "AppImage"
      ],
      "category": "Development"
    },
    "directories": {
      "app": "release/app",
      "buildResources": "assets",
      "output": "release/build"
    },
    "extraResources": [
      "./assets/**"
    ]
  },

My preload.js file is requiring a module (module.umd.js) that is reading from three .trie files, so my folder structure looks like this:

enter image description here

Once builded, the app is not working and I see this error on the web console inspector:

Error: ENOENT, dist\main\data.trie not found in C:\Users\ivan\Desktop\app-electron\release\build\win-unpacked\resources\app.asar

So my question is: Do I have to somehow add those .trie files in app.asar in order to solve this problem?

  • I have experienced something similar for a specific package from npm, but in Angular, it was `@foliojs-fork`. Here, i needed to adapt angular.json in the `assets` section, input / output-wise. I do not know the parallel behaviour in React. If you do, let me know, and i will formulate an answer. – Gary Klasen Oct 06 '22 at 07:49
  • It turns out that those .trie files should be included in the app.asar archive in order to work. Anyways, I'm still confused about how should I change my configuration in order include those files in the final package. – Ivan Taccadoli Oct 11 '22 at 20:08
  • I could post how this is done in `angular.json`, when you know how to port this to react – Gary Klasen Oct 12 '22 at 06:31

0 Answers0