Monorepo with both Lerna/Yarn Workspaces and electron-builder

Hi there, I’m working on an IDE that is trying to house both the Development and Production environments in one repository. I want to be able to do development on the IDE and extensions and run the project locally. Then in the same repo I want to be able to package the application by running the electron-builder to get my AppImage executable. However, because Yarn workspaces hoists the dependencies to the top level, when the electron-builder is packaging the application it can’t find the dependencies for the extensions/widgets. I tried using the nohoist feature of Yarn workspaces, but was still running into issues building the AppImage. Does anyone have any examples or this being done? Or have you successfully done this? Any help would be much appreciated.

[original thread by danieltomasku]


A base reference for the desired app structure:

- package.json
- packages
    |- custom-widget-1
    |- custom-widget-2
- electron
    |- electron-builder.yml
    |- package.json
- browser
    |- package.json

@kittaakos Could you help please?

The last time we used the electron-builder as-is on the Theia monorepo, we were facing the same difficulties. We came up with our own, in-house electron packager for downstream projects. As of today, it is not open-source but here are a few hints:

  • We build the application in a temporary location so that the main node_modules content does not interfere. No symlinks, hence the dependencies can be resolved correctly.

  • We reuse the package.json from the electron-example and merge it with the electron packaging configuration.

  • We reuse the yarn.lock for the final electron application so that the dependencies will be precisely the same as in the electron-example.

  • We use depcheck to remove unused dependencies from the final electron application.

Please note, it was more than a year now, maybe the most recent version of electron-builder supports it out of the box with some particular configuration.


Thank you for the response @kittaakos @anton-kosyakov . I think we’re going to move forward with having two separate repositories–one for IDE/widget development and one for building our AppImage. This seems to be consistent with some of the example Theia-based IDEs like the Yangster IDE.Supposedly this commit addresses hoisted dependencies for the electron-builder, but I could not get it to work.