Skip to content

Commit 117bc69

Browse files
Static export conditional.
1 parent 10e7b44 commit 117bc69

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

next.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import type { NextConfig } from 'next'
33
// A helper variable to easily check if we are in static export mode.
44
const isStaticExport = process.env.NEXT_OUTPUT_MODE === 'export'
55

6+
console.log(`Next.js static export mode: ${isStaticExport}`)
7+
68
const nextConfig: NextConfig = {
79
/**
810
* FIX: The 'turbo' settings have been moved to the top-level 'turbopack' property
@@ -58,4 +60,12 @@ const nextConfig: NextConfig = {
5860
},
5961
}
6062

63+
// Only include page.* files for static export, include route.* for all other builds
64+
if (isStaticExport) {
65+
(nextConfig as any).pageExtensions = ['page.tsx', 'page.ts', 'page.jsx', 'page.js']
66+
} else {
67+
(nextConfig as any).pageExtensions = [
68+
'route.ts', 'route.js', 'page.tsx', 'page.ts', 'page.jsx', 'page.js'
69+
]
70+
}
6171
export default nextConfig

0 commit comments

Comments
 (0)