【发布时间】:2022-04-27 06:56:05
【问题描述】:
next-config.js
/** @type {import('next').NextConfig} */
module.exports = {
i18n: {
locales: ['en', 'ru'],
defaultLocale: 'en',
},
publicRuntimeConfig: {
API_URL: process.env.API_URL,
},
images: {
domains: ['fakestoreapi.com'],
},
trailingSlash: true,
webpack: (config, { isServer }) => {
const newConfig = { ...config };
if (!isServer) {
newConfig.resolve.fallback.fs = false;
}
return newConfig;
},
};
下一个站点地图版本 - "next-sitemap": "^2.1.15",
next-sitemap.js
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: 'https://box.hedgefun.net/',
generateRobotsTxt: true,
};
您可以在上面看到,当我尝试使用next-sitemap 创建站点地图时,我找到了将fs 添加到next-config.js 文件的解决方案,用于webpack 5。但它告诉我下一个问题。我该如何解决?
node -v
v14.16.0
【问题讨论】: