Docz: Module not found: Error: Can't resolve 'react' in monorepo.

Created on 10 Sep 2019  路  4Comments  路  Source: doczjs/docz

Bug Report

2.x releases of docz gives Module not found errors when trying to start it with docz dev.

To Reproduce

  1. Clone this repo
  2. yarn to install dependencies.
  3. yarn workspace test-dev-1 start:docz to reproduce error.
  4. yarn workspace test-dev-2 start:docz to see it is working correctly with docz 1.x

Expected behavior

I believe, I did not miss anything in migration guide and this should work correctly.

Environment

  • OS: Arch Linux, kernel 5.2.11
  • Node/npm version:

    • yarn: 1.17.3

    • node: 12.9.1

Additional context/Screenshots

  • Project lives in a monorepo, possibly related.
  • mdx files import components from files compiled by rollup, possibly unrelated.
bug pending-user-response v2

All 4 comments

Hello @mehmetcozdemir

Thank you for the neat problem repro 馃憤

I'm afraid currently the docz v2 package can't be used as a cli in a monorepo / workspacce (fixing that is on our backlog).

However, that doesn't mean that you can't use docz at all.

You can easily set docz up as a gatsby theme in a package in a monorepo.

Check out this example to see how to add docz to a gatsby app and to use docz in a mono-repo.

@rakannimer Thank you for fast response. I will just stay on 1.x I guess. If there is another issue for this bug, you can close this one. Otherwise I will be following here for updates. Thank you again.

Hey,

Can you try with the latest next version (v2.0.0-rc.55) ?

It should work, we've added an example (and e2e test) for adding docz in a single package in a monorepo here : https://github.com/doczjs/docz/tree/master/examples/monorepo-package

And another to add docz at the root of the monorepo here : https://github.com/doczjs/docz/tree/master/examples/monorepo

It is working correctly in reproduction repo. I also did a quick trial on my company repos and there seems to be no issue there too. Thank you for your time! :tada:

Edit: Mixed my company and personal accounts :man_facepalming:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mquandalle picture mquandalle  路  3Comments

YardWill picture YardWill  路  3Comments

danburzo picture danburzo  路  3Comments

ssylvia picture ssylvia  路  3Comments

ilyanoskov picture ilyanoskov  路  3Comments