Warning: Could not map element with type "tag"
See original GitHub issueWe recently switched from npm to yarn to handle our install. Upon switching over, the Markdown components would not longer render and would display a warning:
Warning: Could not map element with type "tag"
I have tracked down that this occurs when checking the node types (node instanceof Element
) MarkdownView.tsx#L48.
Removing this typecheck along with similar typechecks within this file resolves this issue. I believe this is being caused by a miss matched version of domhandler
. domhandler
is an undocumented dependency for react-showdown
. It is also a dependency of htmlparser2
(a documented dependency for react-showdown
.
It might well be more complicated than that because htmlparser2@4.1
(now on version 6) seems to rely on multiple versions of domhandler
versions 3 (directly) and 4 (via domutils@2.0
) .
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:9 (5 by maintainers)
Top GitHub Comments
I created https://github.com/jerolimov/react-showdown/pull/65 😃
shows the conflicting versions. The solution is to force only the installation of one of those, which is
domhandler@4.0.0
, trying to enforcedomhandler@3.3.0
will result in some cannot read children of undefined error.You can enforce the version locally with yarn resolutions. Since I am using npm in my project together with vite as a bundler (I did not experience this issue with create-react-app/webpack), and there is no equivalent I had to use the resolve map in the
vite.config.js
: