Next.js Discord

Discord Forum

Invalid next.config.mjs options detected

Unanswered
Masai Lion posted this in #help-forum
Open in Discord
Avatar
Masai LionOP
Hello,
Upon building my project I am seeing the following error…
> next build

 ⚠ Invalid next.config.mjs options detected: 
 ⚠     Unrecognized key(s) in object: 'runtime', 'serverExternalPackages' at "experimental"
 ⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config
  ▲ Next.js 15.0.1
  - Environments: .env.local
  - Experiments (use with caution):
    · turbo

I believe this is connected to my Postmark implementation, which works on local, but this error, suggest in may not on production. My next.config.mjs file looks as such…
import createMDX from "@next/mdx";
import { fileURLToPath } from "url";
import { dirname, join } from "path";

/** @type {import('next').NextConfig} */
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const nextConfig = {
  reactStrictMode: true,
  sassOptions: {
    includePaths: [join(__dirname, "src/styles")],
  },
  assetPrefix:
    process.env.NODE_ENV === "development" ? "http://localhost:3000" : "",
  pageExtensions: ["js", "jsx", "md", "mdx", "ts", "tsx"],
  experimental: {
    runtime: "nodejs",
    serverExternalPackages: ["postmark"],
  },
};

const withMDX = createMDX();

export default withMDX(nextConfig);

Is this setup incorrectly?

0 Replies