-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
24 lines (21 loc) · 964 Bytes
/
Copy pathnext.config.ts
File metadata and controls
24 lines (21 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import type { NextConfig } from "next";
// GitHub Pages serves this project site under /<repo>/. Apply the base path only
// for production builds so local `npm run dev` keeps working at the root.
const isProd = process.env.NODE_ENV === "production";
const repoBasePath = "/copilot-billing-forecast";
const nextConfig: NextConfig = {
// Emit a fully static site into ./out for GitHub Pages.
output: "export",
// next/image optimization needs a server, which static export does not have.
images: { unoptimized: true },
// Serve pages with trailing slashes so deep links resolve as static files.
trailingSlash: true,
basePath: isProd ? repoBasePath : undefined,
assetPrefix: isProd ? `${repoBasePath}/` : undefined,
// Expose the base path to the client so it can fetch public assets
// (e.g. the optional preloaded report) at the correct URL.
env: {
NEXT_PUBLIC_BASE_PATH: isProd ? repoBasePath : "",
},
};
export default nextConfig;