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

TypeError: (0 , unist_util_visit__WEBPACK_IMPORTED_MODULE_1__.visit) is not a function #840

Closed
4 tasks done
adam-magyar-instructure opened this issue Jul 9, 2024 · 3 comments
Labels
🙋 no/question This does not need any changes 👎 phase/no Post cannot or will not be acted on

Comments

@adam-magyar-instructure
Copy link

Initial checklist

Affected packages and versions

9.0.1

Link to runnable example

No response

Steps to reproduce

`import React from 'react';
import { Heading, Img, Link, Text } from '@own-ui-lib';
import Markdown from 'react-markdown';

export function OwnUIMarkdown({ markdown }: { markdown: string }) {
return (
<Markdown
components={{
h1: ({ node, className, children, ...props }) => {children},
h2: ({ node, className, children, ...props }) => {children},
h3: ({ node, className, children, ...props }) => {children},
h4: ({ node, className, children, ...props }) => {children},
h5: ({ node, className, children, ...props }) => {children},
strong: ({ node, className, children, ...props }) => {children},
em: ({ node, className, children, ...props }) => {children},
a: ({ node, className, children, ...props }) => (

{children}

),
img: ({ node, className, children, ...props }) => <Img src={props.src ?? ''} alt={props.alt} />,
text: ({ node, className, children, ...props }) => {children},
p: ({ node, className, children, ...props }) => (

{children}

),
}}>
{markdown}

);
}
`

When using the component below I got the following error in the console and it breaks our application:

image

Expected behavior

It should not break the application and should render the markdown.

Actual behavior

It breaks the application.

Runtime

Node v17

Package manager

npm 8

OS

macOS

Build and bundle tools

Webpack

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Jul 9, 2024
@ChristianMurphy
Copy link
Member

Welcome @adam-magyar-instructure! 👋
Sorry you ran into a spot of trouble.

This isn't a react-markdown bug, but a webpack one. (Example of react-markdown working fine https://stackblitz.com/github/remarkjs/.github/tree/main/sandbox-templates/react-markdown-with-vite)

Some likely root causes:

  1. Using outdated webpack, it had bugs in previous major versions which have since been resolved
  2. Using an incorrect webpack configuration (check the module resolution)

A helpful guide on common issues using ESM with outdated package managers https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

@ChristianMurphy ChristianMurphy closed this as not planned Won't fix, can't repro, duplicate, stale Jul 9, 2024
@ChristianMurphy ChristianMurphy added the 🙋 no/question This does not need any changes label Jul 9, 2024

This comment has been minimized.

@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Jul 9, 2024
@remcohaszing
Copy link
Member

Another potential cause:

  • You’re possibly using npm overrides / yarn resolutions. You should never use this unless you’re absolutely sure what you’re doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 no/question This does not need any changes 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

3 participants