
I'm trying to use the @zeit/next-mdx package to import .mdx files (and their metadata) into one of my pages. I'm pretty sure I'm using the plugin correctly. I'm also using TypeScript (potential source of error), but have defined an mdx.d.ts:
`
declare module '*.mdx' {
let MDXComponent: (props) => JSX.Element
export default MDXComponent
}
`
I believe that I've properly configured the plugin in my next.config.js. To see the project more in depth, check out the repository.
The console log (line 7 in pages/Landing/index.tsx) is supposed to print out the imported MD as a JSX/TSX-compatible component and the metadata as an object literal.
Thank you so so so much for taking the time to look this over. Please let me know if you have any questions. I searched pretty hard and don't see this issue elsewhere. Apologies in advance if the answer is obvious. Hopefully this is helpful to others as well.
Hey, just checking in. I'd love to implement MDX in a NextJS site. I would really really really appreciate any suggestions or support 馃檹 loving the framework and can't wait to use it in production.
Thank you,
Harry
Having the same issue here as well!
Hi hi hi
I noticed that next-mdx has a different signature with the other plugins (#320).
You should add () to your next.config.js and it should work:
// https://github.com/harrysolovay/NextJS-TypeScript-MDX/blob/master/next.config.js
const withSourceMaps = require('@zeit/next-source-maps')
const withMDX = require('@zeit/next-mdx')() // <--
const mdxImagesPlugin = require('remark-images')
const mdxEmjoiPlugin = require('remark-emoji')
Most helpful comment
I noticed that next-mdx has a different signature with the other plugins (#320).
You should add
()to yournext.config.jsand it should work: