Next.js Discord

Discord Forum

Render markdown files as React Components

Unanswered
Corn Crake posted this in #help-forum
Open in Discord
Corn CrakeOP
Currently I'm importing my markdown file and I need it to render as HTML, I'm using react-markdown for that. But when launching the application locally I'm getting this errors

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file 


I already set up the @next/mdx, I don't really know what to do now and I need some guidance on this topic

This is my next.config
const withMDX = require('@next/mdx');

/** @type {import('next').NextConfig} */

const nextConfig = {
  images: {
    dangerouslyAllowSVG: true,
    contentDispositionType: 'attachment',
    contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
  },
  pageExtensions: ['md', 'mdx', 'tsx'],
};

module.exports = withMDX(nextConfig);

0 Replies