How to Implement sitemap.ts When Using output: 'export' in Next.js 15

This article was written by AI after a human verified the implementation. Background When using static site generation (output: 'export') in Next.js 15, errors may occur with the sitemap.ts implementation. E r r o r : e x p o r t c o n s t d y n a m i c = " f o r c e - s t a t i c " / e x p o r t c o n s t r e v a l i d a t e n o t c o n f i g u r e d o n r o u t e " / s i t e m a p . x m l " w i t h " o u t p u t : e x p o r t " . Solution This issue can be resolved by adding the following two exports to sitemap.ts: ...

July 26, 2025 · 5 min · Nakamura