24 lines
615 B
JavaScript
24 lines
615 B
JavaScript
// next.config.js
|
|
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
distDir: 'build', // 改变默认的 .next 目录
|
|
reactStrictMode: true,
|
|
output: 'export', // 启用静态导出
|
|
trailingSlash: true, // 添加尾部斜杠
|
|
images: {
|
|
unoptimized: true, // 静态导出时禁用图片优化
|
|
},
|
|
// 静态导出时的路径配置
|
|
assetPrefix: process.env.NODE_ENV === 'production' ? '' : '',
|
|
// 生成 sitemap
|
|
async rewrites() {
|
|
return [
|
|
{
|
|
source: '/sitemap.xml',
|
|
destination: '/api/sitemap',
|
|
},
|
|
];
|
|
},
|
|
};
|
|
module.exports = nextConfig;
|