sanity-io / sanity-plugin-markdown

Markdown support in the Sanity Studio
MIT License
51 stars 8 forks source link

Global CSS cannot be imported from within node_modules on Next.js app #46

Closed efadhemon closed 1 year ago

efadhemon commented 1 year ago

I am using sanity-plugin-markdown@3.0.0-v3-studio.7 in my next.js app. And it shows this compile 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

doinghun commented 1 year ago

Yeah this plugin does not work with nextjs + sanity v3

dawnchan030920 commented 1 year ago

I'v also met this problem. Is there any way to fix it?

efadhemon commented 1 year ago

I'v also met this problem. Is there any way to fix it?

I also don't found any solutions. some days ago it release v3.0.0 and they are mentions that it not support in next.js. until they fix it we should wait. If you find any solutions please mention me.

Rychillie commented 1 year ago

duplicate issue #27

duffpop commented 1 year ago

+1 from me. I've attempted to use next-mdx-remote in place of this package, but it's far more convoluted and troublesome.

mustaqimarifin commented 1 year ago

I was playing around with the app directory and it was pretty jank but it seems to be working fine now after copying over the minified css from dist folder of the @uiw/react-md-editor and imported it in app/layout.tsx

edit: I should prob add that I got that minified file after first installing @uiw/react-md-editor, copied the css from node_modules then deleted it the package just to see if it'd work without it

efadhemon commented 1 year ago

I was playing around with the app directory and it was pretty jank but it seems to be working fine now after copying over the minified css from dist folder of the @uiw/react-md-editor and imported it in app/layout.tsx

edit: I should prob add that I got that minified file after first installing @uiw/react-md-editor, copied the css from node_modules then deleted it the package just to see if it'd work without it

I try this but not working. Can you share example how you do that.