sadmann7 / skateshop

An open source e-commerce skateshop build with everything new in Next.js.
https://skateshop.sadmn.com
MIT License
5.3k stars 761 forks source link

Replace Contentlayer #127

Open capsloq opened 8 months ago

capsloq commented 8 months ago

This is more of on suggestion rather than an issue.

I was recently looking for a replacement for Contentlayer. I love Contentlayer but it's not maintained anymore. The sponsor pulled the funding and it's future is uncertain. I needed something that is working with Nextjs 14 and a larger amount of MDX Files (~5k). My main issue was running out of memory. I am suspecting a memory leak within Contentlayer when used within a Nextjs 14 project.

Originally i used skateshop to jumpstart the project so i have a similar use of technologies / packages in my project. Anyways, for the switch i did some research and decided on https://github.com/zce/velite.

Velite is very very similar to Contentlayer. The author even says he took Contentlayer as heavy inspiration and just started Velite because Contentlayer is no longer maintained. So if you know Contentlayer you will be quick to pick up Velite.

I refactored my Nextjs14 project containing 4.800 MDX Files from Contentlayer to Velite and that resolved a lot of typing issues as well as running out of memory. I was also able to turn Partial Prerendering back on. That is/was an issue within this project (skateshop) at the time.

Unfortunately, i can't share my project since it's closed source. However the refactoring was done within a day since the libraries are so similar.

Not associated with Velite just wanted to share. There might be other great MDX Libs e.g. https://github.com/souporserious/mdxts The main issue is Contentlayer not being maintained anymore.