Files
cs249r_book/interviews/staffml/next.config.mjs
Vijay Janapa Reddi 7fac33b3ca fix(staffml): enable trailingSlash to fix dev-preview 404s
Without trailingSlash, Next's static export emits /practice.html, but
the dev preview at harvard-edge.github.io/cs249r_book_dev/staffml is
linked into the surrounding Quarto book — any URL like /staffml/practice/
(trailing slash) doesn't match practice.html, so GitHub Pages falls
through to the Quarto-rendered 404 page. With trailingSlash: true,
Next emits practice/index.html and GitHub Pages serves both the with-
and without-slash forms (auto-redirecting no-slash to with-slash).

Verified by building locally: out/practice/index.html, out/explore/index.html,
out/gauntlet/index.html now exist; no orphan practice.html at the root.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 17:15:05 -04:00

24 lines
895 B
JavaScript

import path from 'path';
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
// Emit `<page>/index.html` instead of `<page>.html` so GitHub Pages serves
// trailing-slash URLs (e.g. /staffml/practice/) correctly. Without this the
// dev preview returns 404 for any deep link with a trailing slash, which
// falls through to the surrounding Quarto book's 404 template.
trailingSlash: true,
images: { unoptimized: true },
poweredByHeader: false,
// When deployed to a subdirectory (e.g. /interviews/), set NEXT_PUBLIC_BASE_PATH=/interviews
basePath: process.env.NEXT_PUBLIC_BASE_PATH || '',
outputFileTracingRoot: path.join(process.cwd(), '../../'),
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
};
export default nextConfig;