Skip to content

Cannot resolve node_modules require when building from yarn workspace #8956

Closed
@Lemonexe

Description

@Lemonexe

Application built by running electron-builder in a yarn workspace from repository root is broken.
Runtime dependencies are missing; it seems that node_modules are not crawled during build at all.
Suspected cause in #8571.
Here is a reproduction example with branches for latest vs. last stable version (26.0.3).

Notes

I used is-odd as a simplest possible dependency, but I think the usecase is mainly for packages with native code.
I first discovered the problem with blake-hash package; our project uses Webpack for all of main, renderer and preload processes, so all JS-only packages are bundled, and only the native code packages remain as runtime requires, and get packed into app.asar.unpacked.
Nevertheless, the problem is reproducible with any runtime require, even though is-odd goes to app.asar and not app.asar.unpacked.

Possible duplicates

Possible duplicates of this issue, but they don't provide that much information so I can't tell 100%:

Also related to yarn workspaces, but internal import instead of external, so I don't believe it's the same thing:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions