Skip to content

Example in React template throws cannot resolve dependency 'react' -- only with Lerna monorepo #116

@kirjai

Description

@kirjai

Current Behavior

When creating a new library with tsdx, by running npx tsdx create some-name and choosing the react template, when attempting to run the example, the build fails with a Cannot resolve dependency 'react' error.

Expected behavior

Build should not fail.

Suggested solution(s)

From what I understand, because the package.json inside example defines react and react-dom as aliases to the root directory node_modules, and the root package.json defines react as a peer dependency, we end up in a situation where react is never installed, hence the cannot resolve dependency error.

Reverting the changes introduced in #88 locally, solves the problem. So removing the aliases and defining react and react-dom as dependencies inside example/package.json works as expected.

Your environment

Software Version(s)
TSDX 0.5.12
TypeScript 3.4.5
Browser n/a
npm/Yarn 1.9.4
Operating System Mac OS 10.14.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: supportAsking for support with something or a specific use casescope: docsDocumentation could be improved. Or changes that only affect docsscope: integrationRelated to an integration, not necessarily to core (but could influence core)topic: monorepoRelated to Lerna monorepos

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions