/** @type {import('next').NextConfig} */ const isExport = process.env.NEXT_OUTPUT_MODE === 'export'; /** @type {import('next').NextConfig} */ const nextConfig = { distDir: 'build', output: isExport ? 'export' : 'standalone', trailingSlash: isExport, ...(!isExport && { async redirects() { return [ { source: '/', destination: '/zh', permanent: false, }, ]; }, async rewrites() { return [ { source: '/zh-tw', destination: '/tw', }, { source: '/zh-hk', destination: '/tw', }, ]; }, }), }; export default nextConfig;