Invalid next.config.js options detected
Answered
Rafeiro do Alentejo posted this in #help-forum
Rafeiro do AlentejoOP
Hello, I am trying to use transpilePackages option in next.configue.js, but it is showing me the following error:
My next.js version is 13.0.7, but I used a react leaflet template to set up the base of the project which still uses the pages directory, does that have any impact on this issue?
here is my config file:
warn - Invalid next.config.js options detected:
- The root value has an unexpected property, transpilePackages, which is not in the list of allowed properties (amp, analyticsId, assetPrefix, basePath, cleanDistDir, compiler, compr
ess, crossOrigin, devIndicators, distDir, env, eslint, excludeDefaultMomentLocales, experimental, exportPathMap, generateBuildId, generateEtags, headers, httpAgentOptions, i18n, images
, onDemandEntries, optimizeFonts, output, outputFileTracing, pageExtensions, poweredByHeader, productionBrowserSourceMaps, publicRuntimeConfig, reactStrictMode, redirects, rewrites, sassOptions, serverRuntimeConfig, staticPageGenerationTimeout, swcMinify, trailingSlash, typescript, useFileSystemPublicRoutes, webpack).My next.js version is 13.0.7, but I used a react leaflet template to set up the base of the project which still uses the pages directory, does that have any impact on this issue?
here is my config file:
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ['react-leaflet-cluster'],
reactStrictMode: true,
webpack: (config) => {
config.module.rules.push({
test: /\.geojson$/,
use: ["json-loader"]
});
config.plugins.push(
new CopyPlugin({
patterns: [
{
from: 'node_modules/leaflet/dist/images',
to: path.resolve(__dirname, 'public', 'leaflet', 'images')
},
],
}),
)
return config
}
}
module.exports = nextConfig;Answered by Rafael Almeida
it should work with the
pages directory too. I would update the Next.js version just to check if it wasn't introduced in a later version (although the docs say 13.0.0). it shouldn't require any changes in your code since these are only minor updates5 Replies
it should work with the
pages directory too. I would update the Next.js version just to check if it wasn't introduced in a later version (although the docs say 13.0.0). it shouldn't require any changes in your code since these are only minor updatesAnswer
Rafeiro do AlentejoOP
thank you, updating seems to fixed the issue even though I was on 13.0.7
Common Greenshank
Hi after update nexjs 12 to 13 I am getting this error while running project:
here is my nextjs.config
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)could you please suggest me what should i do?
European sprat
Create your own #help-forum post but have you tried removing the invalid option like the error says?