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 , cm.visit) is not a function (we can't execute the MDEditor) #385

Closed
LucasNeevs opened this issue May 12, 2022 · 6 comments
Closed

Comments

@LucasNeevs
Copy link

LucasNeevs commented May 12, 2022

Good morning. I need help to solve this issue. We're using in our platform, the latest version of this lib (3.12.3) but, before this, we were using the version 3.12.1. In both cases, when we try to enter in a page that have the MDEditor on it, we can see this error:

image

Error: TypeError: (0 , cm.visit) is not a function

I tried to find this solution on the internet but I found nothing. Could someone help us, please?

@jaywcjlove
Copy link
Member

A reproducing example can be provided using codesandbox.io.
@LucasNeevs

@LucasNeevs
Copy link
Author

LucasNeevs commented May 12, 2022

You can create a free trial account in our platform to see the error.

Free trial account: https://learning.pragmaticworkstraining.com/freeTrial
Correct link to see the error: https://learning.pragmaticworkstraining.com/manageAccount/6

This way is much much better than the codesandbox. Because with this, all of you can see the error in the right scenario.

@jaywcjlove
Copy link
Member

@LucasNeevs I don't know how your code is written.

@RicardoGaefke
Copy link

Same as #383.

@RicardoGaefke
Copy link

Hey guys,

What we know about this error:

  1. The full message error is: Uncaught TypeError: (0 , unist_util_visit__WEBPACK_IMPORTED_MODULE_1__.visit) is not a function
  2. as we use SSR we put the Editor in a next/dynamic wrapper
  3. we were using in our package.json file "next": "^10.0.5" and we removed the caret a few weeks ago.

Anyways I created this to reproduce the dynamic import of the editor we use in our platform (with the versions we do have in our actual package.json: codesandbox.

Do you guys have any tip for us?

Thanks a lot for your attention.

@RicardoGaefke
Copy link

Inspecting the error I've found the build was calling a md-editor dependency which was not automatically installed. So I just run npm i unist-util-visit and now it's working pretty fine. You guys can close this if you want to. Thanks a lot.

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