Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with using MDXProvider with Preact #54

Open
ajstrand opened this issue Nov 22, 2022 · 2 comments
Open

Issue with using MDXProvider with Preact #54

ajstrand opened this issue Nov 22, 2022 · 2 comments

Comments

@ajstrand
Copy link

Hi thanks for your work on this library, it looks really helpful.

I wanted to try and rewrite my personal site using this library, but I wanted to use Preact instead of React.

When I run the dev mode with ‘npm run dev’ I get this error: ‘can’t read property of undefined(reading context)’

I’m paraphrasing, but that’s the gist of the error. It appears to be an issue with MDXProvider and how it handles ‘context’.

Are you aware of any differences between Preact/React handle using ‘context’? Since Preact is supposed to be mostly compatible with React, I’m surprised I’d run into an issue like this. I’ll try to set up a demo and link it to this issue.

@bensmithett
Copy link
Owner

I'm not sure sorry @ajstrand, I haven't tried Preact with MDXProvider. If you can link to a reproduction I can take a look!

@ajstrand
Copy link
Author

ajstrand commented Apr 10, 2023

@bensmithett sorry I wasn’t able to respond until now, but I ended being able to fix my issue by using Yarn instead of npm. For some reason using yarn as the package manager, the dependencies were all installed correctly. When I have time tomorrow, I can write a more detailed comment.

I’m not sure why switching to yarn fixes the issue, but I noticed it when I tried a stripped down version of your template repo on stackblitz, which uses Yarn instead of npm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants