Next.js Discord

Discord Forum

next.config.js error

Unanswered
Common Greenshank posted this in #help-forum
Open in Discord
Common GreenshankOP
Hi after update nexjs 12 to 13 I am getting this error while running project:

yarn run v1.22.19
$ nx serve front-end --port=3000

> nx run front-end:serve --port=3000 
- warn Invalid next.config.js options detected: 
- warn     The root value has an unexpected property, nx, which is not in the list of allowed properties (amp, analyticsId, assetPrefix, basePath, cleanDistDir, compiler, compress, configOrigin, crossOrigin, devIndicators, distDir, env, eslint, excludeDefaultMomentLocales, experimental, exportPathMap, generateBuildId, generateEtags, headers, httpAgentOptions, i18n, images, modularizeImports, onDemandEntries, optimizeFonts, output, outputFileTracing, pageExtensions, poweredByHeader, productionBrowserSourceMaps, publicRuntimeConfig, reactProductionProfiling, reactStrictMode, redirects, rewrites, sassOptions, serverRuntimeConfig, skipMiddlewareUrlNormalize, skipTrailingSlashRedirect, staticPageGenerationTimeout, swcMinify, target, trailingSlash, transpilePackages, typescript, useFileSystemPublicRoutes, webpack).
- warn See more info here: https://nextjs.org/docs/messages/invalid-next-config
(0 , next_1.default) is not a function

———————————————————————————————————————————————

>  NX   ERROR  Running target "front-end:serve" failed

  


here is my nextjs.config

/** @type {import('next').NextConfig} */
const withNx = require('@nrwl/next/plugins/with-nx');

const nextConfig = {
  i18n: {
    locales: ['en'],
    defaultLocale: 'en',
  },
  nx: {
    svgr: false,
  },
  async rewrites() {
    return [
      {
        source: '/graphql',
        destination: `${process.env.NX_PUBLIC_SERVER_URL}`,
      },
    ];
  },
  env: {
    MOONLY_CLIENT_HOST: process.env.MOONLY_CLIENT_HOST
  }
}

module.exports = withNx(nextConfig)

2 Replies

European sprat
if you remove the "nx" property from nextConfig does it work? if yes, then i'd suggest looking at the nx docs to see if anything has changed for their configuration to use with the app directory
(or 13 in general if you're still using pages)