Closed qzed closed 3 months ago
I've narrowed it down a bit more: The error happens when updating from v14.1.4 to v14.2.0. Which unfortunately seems like a rather large update...
Could you share the repository? Happy to take a closer look to find out what is wrong.
It is unlikely to be just Next.js alone as my template repository uses Next 14.2.3 without issue
I've made the repo public at https://github.com/qzed/qzed.github.io. MDX/rehype related stuff is in https://github.com/qzed/qzed.github.io/blob/main/src/components/Mdx.tsx.
Thanks for looking into this.
Hi @qzed, I found that it seems to work fine if there's the visibility: devel
key in the post. Hence this test post works fine but this one throws an error.
I am still not too sure what's the root cause of the error but my guess is that it might be related to how next-mdx-remote-client
is transforming and passing the compiled markdown to Next.js. Maybe there's a change between the Next versions that breaks an expected behaviour...
Hmm, so that key is just something that I use to filter posts based on production/dev env in https://github.com/qzed/qzed.github.io/blob/main/src/lib/blog.tsx#L77.
For me, things work when I run yarn dev
but not yarn build
. In particular, I can visit both posts successfully when running yarn dev
, but yarn build results in an error. By default, that error is only visible in the irl-maxent post, but if I either remove the visibility: devel
or modify the filter conditions linked above to make the post appear in the production env as well, it will also break on that.
I think you're correct that it is something with next-mdx-remote-client
(or next-mdx-remote
, which shows the same issue). I saw that in your template you use contentlayer, so I think I will give that a try as well (I already thought about giving it a try a while ago, so I guess that's a good reason to do so now...).
Anyway, thanks for your help!
After updating from next v14.1.4 to next v14.2.4,
rehype-citation
with the latestnext-mdx-remote-client
(v1.0.3) fails withwhen I run
yarn build
to build/export a static next.js site. I have also triednext-mdx-remote
(v5.0.0).Unfortunately, this error message is not very helpful to me, so I haven't been able to figure out what exactly is going wrong. All I was able to figure out is that if I comment out the
rehype-citation
plugin, things work as expected. Interestingly, things also work when I runyarn dev
.Please let me know if I can provide any further information to help debug this.