From 6fa3b0315be394f64734a825906f4e4152a85d7a Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Sun, 23 Jul 2023 21:32:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=99=E6=80=81=E9=83=A8=E7=BD=B2=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/next.config.js b/next.config.js index e6ef9935..27e33e0f 100644 --- a/next.config.js +++ b/next.config.js @@ -98,13 +98,12 @@ module.exports = withBundleAnalyzer({ experimental: { scrollRestoration: true }, - // exportPathMap: (defaultPathMap, { dev, dir, outDir, distDir, buildId }) => { - // const pathMap = { ...defaultPathMap } - // // 忽略/sitemap.xml页面的导出 - // pathMap['/sitemap.xml'] = { page: false } - - // return pathMap - // }, + exportPathMap: async function (defaultPathMap, { dev, dir, outDir, distDir, buildId }) { + // 导出时 忽略/pages/sitemap.xml.js , 否则报错getServerSideProps + const pages = { ...defaultPathMap } + delete pages['/sitemap.xml'] + return pages + }, publicRuntimeConfig: { // 这里的配置既可以服务端获取到,也可以在浏览器端获取到 NODE_ENV_API: process.env.NODE_ENV_API || 'prod', THEMES: themes