Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docz | docz-theme-default] react & react-dom is in dependencies #923

Closed
MunifTanjim opened this issue Jun 18, 2019 · 1 comment
Closed

Comments

@MunifTanjim
Copy link

Bug Report

docz-theme-default and docz's package.json has react & react-dom in both dependencies and peerDependencies. It makes all kind of unwanted behavior in monorepo setups. For example:

If you have react & react-dom installed in the parent directory (./) and docz installed on a child directory (./site) directory, it creates a nasty bug. If you use hooks in your application, this error pops up:

Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app

And it is specifically caused by the point number 1 described in the error message. If you remove the parent directory's node_modules (i.e. ./node_modules) everything works fine.

To Reproduce

  1. mkdir parent && cd parent && npm init
  2. npm install --save-dev react react-dom
  3. mkdir site && cd site && npm init
  4. npm install --save-dev docz docz-theme-default
  5. This will install react & react-dom in ./site/node_modules (which it should not).

Expected behavior

react & react-dom should only be in the peerDependencies

@kpaxqin
Copy link

kpaxqin commented Jun 20, 2019

+1, also meet this bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants