Search code examples
electroncreate-react-appelectron-packagerelectron-forge

electron-forge how to specify a source directory for packaging?


I've rigged create-react-app with the electron-forge app and now I need to somehow specify the build folder produced from the CRA for the packaging. That folder should also be served.

Would such a thing be possible with electron-forge?


Solution

  • I understand are you asking how to tell electron-forge which directory to find your source files in for packaging the app.

    If so, see: https://github.com/electron-userland/electron-packager/blob/master/docs/api.md

    where it describes the options of the

    "config": { "forge": {

    object in your package.json file

    inside they there is this package config object:

      "electronPackagerConfig": {
        "dir": "./src",
    

    where you can specify your source folder.

    Also, BTW: there you can specify files/file-regexs to be ignored in packaging:

        "ignore": [".idea", ".gitignore"]