vercel/next.js · error

The "target" property is no longer supported in ${configFile

Error message

The "target" property is no longer supported in ${configFileName}.
See more info here https://nextjs.org/docs/messages/deprecated-target-config

What it means

Thrown at config.ts:2103 when `target` is present and not equal to `'server'`. The `target` config option (e.g. `'serverless'`) was removed from Next.js; the check allows `'server'` for backward compatibility but any other value throws. The error links to the deprecated-target-config docs.

Source

Thrown at packages/next/src/server/config.ts:2104

    // Always validate the config against schema in non minimal mode
    if (!process.env.NEXT_MINIMAL && !silent) {
      await validateConfigSchema(
        userConfig,
        configFileName,
        curLog.warn,
        (messages) => {
          // Capture validation messages for MCP error reporting
          if (messages.length > 0) {
            const fullMessage = messages.join('\n')
            NextInstanceErrorState.nextConfig.push(new Error(fullMessage))
          }
        }
      )
    }

    if ((userConfig as any).target && (userConfig as any).target !== 'server') {
      throw new Error(
        `The "target" property is no longer supported in ${configFileName}.\n` +
          'See more info here https://nextjs.org/docs/messages/deprecated-target-config'
      )
    }

    if (reactProductionProfiling) {
      userConfig.reactProductionProfiling = reactProductionProfiling
    }

    if (
      userConfig.experimental?.lightningCssFeatures &&
      !userConfig.experimental?.useLightningcss &&
      bundler !== Bundler.Turbopack
    ) {
      curLog.warn(
        `experimental.lightningCssFeatures is set but experimental.useLightningcss is not enabled. ` +
          `The lightningCssFeatures option has no effect without useLightningcss.`
      )

View on GitHub (pinned to 0ae8c72462)

Solutions

  1. Remove the `target` property entirely — modern Next.js defaults to the supported server output.
  2. If you relied on serverless output, use the `output: 'standalone'` or `output: 'export'` option instead, as appropriate.

Example fix

// before
module.exports = { target: 'serverless' }
// after
module.exports = {} // target removed; or use output: 'standalone' if you need a self-contained build
Defensive patterns

Strategy: validation

Validate before calling

if (config.target !== undefined && config.target !== 'server') {
  throw new Error('target is no longer supported');
}

Type guard

function targetIsAllowed(c: any): boolean {
  return c.target === undefined || c.target === 'server';
}

Prevention

When it happens

Trigger: `module.exports = { target: 'serverless' }`; `{ target: 'experimental-serverless-trace' }`; `{ target: 'edge' }`.

Common situations: Upgrading from Next.js 11/12 where `target: 'serverless'` was used for Vercel-style deployments; old tutorials recommending `target`.

Related errors


AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06). Data as JSON: /api/errors/a1235e1929643412. Report an issue: GitHub.