mattjennings / react-modal

React modal components built for theme-ui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

not working with nextjs app

daniloab opened this issue · comments

Hello, first congrats on the cool lib. For those who use themes UI looks to be very simple and easy to use.

I'm trying to use this modal lib with nextjs, but when I install it and try to import returns errors that are not found:
Screen Shot 2022-06-27 at 19 30 34

How can I fix this?

hey @daniloab , sorry I haven't used this library in a long time but I took a brief look at this. It seems theme-ui has gotten quite a few updates, including depending on a version of @mdx-js/react that seems to break nextjs due to something with esm. I wasn't getting the erorr you got, but after some tinkering I got it to work. Please check out this example here https://codesandbox.io/s/react-modal-nextjs-x5j48f

Try to match the dependency versions of that example in package.json. Hopefully this helps!

(I actually did get the error you got but only within CodeSandbox, and it would go away if I restarted the server. So I'm not sure if that was CodeSandbox messing up with the npm installs, but it never happened to me locally)