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
279 stars 49 forks source link

Markdown.css gives error in NextJs #218

Open mnijhum opened 1 year ago

mnijhum commented 1 year ago
error - ./node_modules/@uiw/react-markdown-preview/esm/styles/markdown.css
Global CSS cannot be imported from within node_modules.
Read more: https://nextjs.org/docs/messages/css-npm
Location: node_modules/@uiw/react-markdown-preview/esm/index.js
jaywcjlove commented 1 year ago

@mnijhum

paparobot commented 1 year ago

Next.JS does not support importing CSS in components, it only supports xxx.module.css in components. You may try to download the source code and move it to your local component folder. Then move markdown.css to your style folder, remove all the imports in original source code and import markdown.css file in index.css like this: @import './markdown.css';

jaywcjlove commented 1 year ago

@RedboxRobot https://github.com/uiwjs/next-remove-imports/tree/main/example