Reputation: 39
warn - Invalid
next.config.js
options detected:
The root value has an unexpected property, target, which is not in the list of allowed properties (amp, analyticsId, assetPrefix, basePath, cleanDistDir, compiler, compress, 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).Error: The "target" property is no longer supported in
next.config.js
.
This is my next.config.js
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
module.exports = withBundleAnalyzer({
target: "serverless",
env: {
BASE_URL: process.env.BASE_URL,
},
webpack(conf) {
conf.module.rules.push({
test: /\.svg$/,
use: [
{
loader: "@svgr/webpack",
options: {
svgoConfig: {
plugins: [
{
// Enable figma's wrong mask-type attribute work
removeRasterImages: false,
removeStyleElement: false,
removeUnknownsAndDefaults: false,
// Enable svgr's svg to fill the size
removeViewBox: false,
},
],
},
},
},
],
});
conf.resolve.modules.push(__dirname);
return conf;
},
});
I thought it was a module issue so I reinstalled it but it was true. I tried following the format on the button link, but I can't figure out how to do it.
Upvotes: 0
Views: 2250
Reputation: 1803
The error message is clear:
Error: The "target" property is no longer supported in next.config.js.
The property target: "serverless"
is deprecated in nextJs version 12, accordingly to this issue, the recommendation is to remove this property and use output: "standalone"
instead.
See also, this section in nextJs docs for more information about it.
Upvotes: 1