uiwjs / react-markdown-preview

React component preview markdown text in web browser. The minimal amount of CSS to replicate the GitHub Markdown style. Support dark-mode/night mode.
https://uiwjs.github.io/react-markdown-preview
MIT License
277 stars 49 forks source link

Bug: Issue with `rehype-rewrite` not adhering to strict EcmaScript Module standard #125

Closed tvsbrent closed 2 years ago

tvsbrent commented 3 years ago

With the recent bump of the rehype-rewrite module to version 2.x in the version 3.3.1 release, we are seeing an error in our Webpack 5 builds:

  ERROR in ./node_modules/rehype-rewrite/lib/index.js 1:0-28
  Module not found: Error: Can't resolve './visit' in '<path>/node_modules/rehype-rewrite/lib'
  Did you mean 'visit.js'?
  BREAKING CHANGE: The request './visit' failed to resolve only because it was resolved as fully specified
  (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
  The extension in the request is mandatory for it to be fully specified.
  Add the extension to the request.

I reported this to the author of that library, but I'm not sure he is going to address the issue. I thought I'd let you know as well, in case there are other options to address this.

For the moment, we have pinned @uiw/react-md-editor (which is pulling this dependency in) to version 3.6.1. That was the last version of that library that referred to version 3.3.0 of this library.

tvsbrent commented 3 years ago

Updating this issue, the author has addressed it with version 2.1.1, so I'm guessing the regular renovatebot updates will catch this for a future release.

jaywcjlove commented 3 years ago

@tvsbrent Upgrade @uiw/react-markdown-preview@3.3.3