You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although the example in this repo work as expected, if we use component-docs@0.24.0 as a dependency in another project, the new version breaks the serve as well as build command like in below screenshot:
Another escalation of the issue I found out next is that, if my main project has react as direct dependency but its major version is different from [email protected]'s one (which is ^17.0.1). Say, my project still has react@^16.14.0, then when I execute the component-docs serve command, I got this error:
Error: Cannot find module '@mdx-js/tag'
...
I have to install @mdx-js/tag as direct dependency now, then get a couple of errors regarding missing: react-dom and redbox-react. However, once I installed those missing dependencies, I get this run time error:
Error: 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
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
Reproducible Demo
cd into example folder, and init a package.json. Add [email protected] as dependency and with some scripts like so:
First execute yarn docs and observe the broken layout of the preview site.
Add [email protected] as direct dependency and observe the compile time error
Add the missing dependencies and observe the errors.
Suggestion
I don't know what happen yet but regarding the mismatch react version, I think we should move react, react-dom to devDependencies and peerDependencies so that component-docs should use the react version in consuming projects and avoid versions conflict.
The text was updated successfully, but these errors were encountered:
Environment
component-docs
@ 0.24.0Description
Although the example in this repo work as expected, if we use
component-docs
@0.24.0 as a dependency in another project, the new version breaks theserve
as well asbuild
command like in below screenshot:Another escalation of the issue I found out next is that, if my main project has
react
as direct dependency but its major version is different from[email protected]
's one (which is ^17.0.1). Say, my project still hasreact@^16.14.0
, then when I execute thecomponent-docs serve
command, I got this error:I have to install
@mdx-js/tag
as direct dependency now, then get a couple of errors regarding missing:react-dom
andredbox-react
. However, once I installed those missing dependencies, I get this run time error:Reproducible Demo
cd
into example folder, and init apackage.json
. Add[email protected]
as dependency and with some scripts like so:yarn docs
and observe the broken layout of the preview site.[email protected]
as direct dependency and observe the compile time errorSuggestion
I don't know what happen yet but regarding the mismatch react version, I think we should move
react
,react-dom
to devDependencies and peerDependencies so that component-docs should use thereact
version in consuming projects and avoid versions conflict.The text was updated successfully, but these errors were encountered: