The docs site is served from the /continue/ subpath on GitHub Pages but next.config.js set no basePath, so /_next CSS/JS, the search index, and images were requested from the domain root and 404'd (unstyled site). - Add basePath/assetPrefix of /continue, gated on GITHUB_ACTIONS so local dev still serves from root - Expose NEXT_PUBLIC_BASE_PATH and add a withBasePath helper for raw absolute asset paths that Next doesn't prefix automatically - Prefix the search-index fetch, logo, and MDX doc images - Guard against double /images/docs/ rewrite in the MDX img component Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
927 B
JavaScript
28 lines
927 B
JavaScript
/** @type {import('next').NextConfig} */
|
|
|
|
// When deploying to GitHub Pages the site is served from the `/continue/`
|
|
// subpath (https://continuedev.github.io/continue/). GitHub Actions sets
|
|
// GITHUB_ACTIONS=true, so we only apply the base path there — local dev
|
|
// (localhost:3005) keeps serving from the root.
|
|
const isGithubPages = process.env.GITHUB_ACTIONS === "true";
|
|
const basePath = isGithubPages ? "/continue" : "";
|
|
|
|
const nextConfig = {
|
|
output: "export",
|
|
basePath,
|
|
assetPrefix: basePath || undefined,
|
|
// Expose the base path to client/runtime code so raw string asset paths
|
|
// (search index fetch, <img> src, etc.) can be prefixed manually — Next only
|
|
// applies basePath automatically to <Link>, next/image and /_next assets.
|
|
env: {
|
|
NEXT_PUBLIC_BASE_PATH: basePath,
|
|
},
|
|
typescript: {
|
|
ignoreBuildErrors: true,
|
|
},
|
|
images: {
|
|
unoptimized: true,
|
|
},
|
|
};
|
|
|
|
module.exports = nextConfig;
|