Skip to content

share() does not work if used in a yarn workspace #94

Open
@janhommes

Description

@janhommes

Yarn workspaces use node_modules resolution algorithm to allow a mono-repository structure. Mostly all modules are placed on the root level so that they can be resolved by any other package in the monorepo. The currently used approach to determine the secondary entry points leads to an error when used in such a setup, as the node_modules resolving is not using the same resolving mechanism. Mostly an error is thrown that the file could not be found, as it might only exist on a node_modules folder some level up.

I guess this line needs to be considered

const libPath = path.join(path.dirname(packagePath), 'node_modules', key);

It maybe should use require.resolve to use the same resolving algorithm like node_modules.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions