hashicorp / next-mdx-remote

Load MDX content from anywhere
Mozilla Public License 2.0
2.73k stars 141 forks source link

feat: upgrade to latest version of `mdx-js` #433

Closed DavieReid closed 8 months ago

DavieReid commented 9 months ago

~Addresses --> https://github.com/hashicorp/next-mdx-remote/issues/432~

Addresses --> https://github.com/hashicorp/next-mdx-remote/issues/419

Alternative to --> https://github.com/hashicorp/next-mdx-remote/pull/425

Wasn't part of the plan but I switched from jest as I ran into this issue --> https://github.com/orgs/vfile/discussions/88

Didnt seem like it would take much effort...hope that's OK.

Update

Published this to npm --> https://www.npmjs.com/package/@daviereid/next-mdx-remote

To get it to work in my next app (v14) I had to add this to my next.config.js

  experimental: {
    serverComponentsExternalPackages: ['@daviereid/next-mdx-remote']
  },

I think this is because I only use this package inside another monorepo package used in server components.

Update 2

I had to upgrade the version of remark-gfm I am using to v4 as that supports version 11 of unified. This is a known issue to the maintainers of this repo --> https://github.com/hashicorp/next-mdx-remote/issues/431#issuecomment-1932000484

hashicorp-cla commented 9 months ago

CLA assistant check
All committers have signed the CLA.

karlhorky commented 9 months ago

@DavieReid thanks for this! Two questions:

  1. The PR description can also include "Closes #419", right?
  2. This maybe should also be marked as an alternative to #425 by @hipstersmoothie ?
karlhorky commented 9 months ago

@dstaley what do you think about these two PRs (this PR and #425) upgrading to @mdx-js/mdx@^3.0.0 and @mdx-js/react@^3.0.0 (as well as other related changes)?

Would it be possible to get one of them merged?

DavieReid commented 9 months ago

@DavieReid thanks for this! Two questions:

  1. The PR description can also include "Closes support MDX v3 #419", right?
  2. This maybe should also be marked as an alternative to mdx3 #425 by @hipstersmoothie ?

Yes you are correct... I have changed the PR description to address your questions and add an additional update re issues I encountered using the package I published from my fork.

hipstersmoothie commented 9 months ago

I don't intend to pursue my PR. if someone else wants to pick it up go for it!

dstaley commented 8 months ago

@DavieReid Thank you so much for submitting this PR! We've made similar changes in the v5 PR, so I'm going to go ahead and close this. I do want to say how much I appreciate you submitting this though!