mdx-table-of-contents not working with next.js
adamsoffer opened this issue · comments
I'm attempting to use the mdx-table-of-contents
package with next.js but when I import the tableOfContents
object it's undefined:
import Document , { tableOfContents } from "../../../reference-api.mdx";
Here's what my next.config.js file looks like:
const toc = require("mdx-table-of-contents");
const withMDX = require("@next/mdx")({
options: {
remarkPlugins: [toc],
},
extension: /\.mdx?$/,
});
module.exports = withMDX({
pageExtensions: ["js", "jsx", "md", "mdx", "ts", "tsx", "svg"],
});
Any idea what I'm doing wrong?