uiwjs / react-md-editor

A simple markdown editor with preview, implemented with React.js and TypeScript.
https://uiwjs.github.io/react-md-editor
MIT License
2.17k stars 157 forks source link

Dynamic import using next/dynamic throws require.e is not a function error #358

Closed pascuflow closed 2 years ago

pascuflow commented 2 years ago

Hi,

So I occasionally get this error when I navigate to my page in next js, if I refresh then the page loads fine.

Screenshot from 2022-03-10 10-41-58 Screenshot from 2022-03-10 10-47-56


import "@uiw/react-md-editor/markdown-editor.css";
import "@uiw/react-markdown-preview/markdown.css";
import dynamic from "next/dynamic";
import rehypeSanitize from "rehype-sanitize";

const MDEditor = dynamic(
    () => import("@uiw/react-md-editor").then((mod) => mod.default),
    { ssr: false }
);
jaywcjlove commented 2 years ago

@pascuflow Provide an example via codesandbox.io?

Example: https://codesandbox.io/embed/nextjs-example-react-md-editor-qjhn7?fontsize=14&hidenavigation=1&theme=dark

pascuflow commented 2 years ago

Cannot seem to reproduce reiliably, going to close.