marigold-ui / marigold

Design System based on react-aria and Tailwind CSS
https://marigold-ui.io
MIT License
108 stars 10 forks source link

Switch to `@next/mdx` #2355

Closed sebald closed 2 years ago

sebald commented 2 years ago

Description

We currently have some issues with next-mdx-remote, namely component just don't work and the size of the first chunk will grow with every component added to the provider (which we have a lot since this is the way we currently load demos ...).

Benefits

We hope that switching to @next/mdx solves these problems and also has some added benefits:

Obstacles

There are some obstacles switching to @next/mdx:

This is not really an obstacle but worth mentioning: currently we have all remark and rehype plugins implemented in TypeScript, but the next config can also be in JavaScript, so we have to convert them.

Implementation

Luckily other people already had the same issues and solved them for us! By using the following plugins we should be able to get the front matter and use it in our next app. This will also allow us to add a global layout inside _app.tsx.

There is also an example app we can use as template:

https://github.com/remcohaszing/recma-nextjs-static-props/blob/4971bb489b70031aaf3ce9f13852de15e64ceed2/next.config.js

sebald commented 2 years ago

Closed via #2390