Next.js Discord

Discord Forum

Error with my config after installing mdx

Unanswered
clarity posted this in #help-forum
Open in Discord
My next.config.mjs:

import withMdx from '@next/mdx';
/** @type {import('next').NextConfig} */

const nextConfig = {
    env: {
        ADMIN_PASS: process.env.ADMIN_PASS,
    },
    images: {
        remotePatterns: [
            {
                protocol: 'https',
                hostname: 'i.gyazo.com',
            },
        ]
    },
    pageExtensions: ['js', 'jsx', 'mdx', 'ts', 'tsx'],
    /* experimental: {
        mdxRs: true,
    }, */
};

export default withMdx(nextConfig);


The error:

 ⚠ Invalid next.config.mjs options detected: 
 ⚠     Unrecognized key(s) in object: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'
 ⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config
   automatically enabled Fast Refresh for 1 custom loader


This seems to be how the documentation wants me to set this up, I'm puzzled.

13 Replies

Relavant info from my package.json as well:

"dependencies": {
    "@mdx-js/loader": "^3.0.1",
    "@mdx-js/react": "^3.0.1",
    "@next/mdx": "^14.2.1",
    "@nextui-org/react": "^2.2.10",
    "@nextui-org/system": "^2.0.15",
    "@nextui-org/theme": "^2.1.18",
    "@types/mdx": "^2.0.13",
    "@vercel/postgres": "^0.8.0",
    "clsx": "^2.1.0",
    "framer-motion": "^11.0.28",
    "next": "14.2.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-hot-toast": "^2.4.1",
    "react-icons": "^5.0.1",
    "uuid": "^9.0.1",
    "zod": "^3.22.4"
  },
  "devDependencies": {
    "@types/node": "^20.12.7",
    "@types/react": "^18.2.78",
    "@types/react-dom": "^18.2.25",
    "@types/uuid": "^9.0.8",
    "autoprefixer": "^10.4.19",
    "eslint": "^9.0.0",
    "eslint-config-next": "14.2.1",
    "postcss": "^8.4.38",
    "tailwindcss": "^3.4.3",
    "typescript": "^5.4.5"
  }


And github repo: https://github.com/clxrityy/mjanglin.com
@!=tgt nextjs automatically loads env variables for you
i know but even removing that i still have the issue, it happened after i added the mdx page extensions
@clarity i know but even removing that i still have the issue, it happened after i added the mdx page extensions
oh wait
ok nvm it's discord
@Ray `export default withMdx()(nextConfig);`
that fixed, thanks!