./node_modules/@uiw/react-markdown-preview/lib/index.js:13:0
Module not found: ESM packages (react-markdown) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals
Import trace for requested module:
./app/page.tsx
https://nextjs.org/docs/messages/module-not-found
Looks like the issue is uiwjs/react-md-editor is CommonJS but react-markdown is ESM, so this line in react-markdown-preview/lib/index.js causes the error above:
var _reactMarkdown = _interopRequireDefault(require("react-markdown"));
Getting this error when I followed the docs:
Looks like the issue is
uiwjs/react-md-editor
is CommonJS butreact-markdown
is ESM, so this line inreact-markdown-preview/lib/index.js
causes the error above:Here's what I have:
next.config.js
app/page.tsx
: