警告-检测到无效的
next.config.js
选项: 根值具有一个意外的属性-- target,它不在允许属性列表中(amp、analyticsId、assetPrefix、basePath、cleanDistDir、编译器、压缩、crossOrigin、devIndicators、distDir、env、eslint、excludeDefaultMomentLocales、实验性、exportPathMap、generateBuildId、generateEtags、headers、httpAgentOptions、i18n、图像、onDemandEntries、optimizeFonts、output、outputFileTracing、pageExtensions、pageExtensions、重定向、重写、重写、#en25、#en26、、webpack)。 错误:在next.config.js
中不再支持“目标”属性。
这是我的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;
},
});
我认为这是一个模块问题,所以我重新安装了它,但这是真的。我试着遵循按钮链接上的格式,但我想不出怎么做。
https://stackoverflow.com/questions/74559626
复制相似问题