Skip to content

Commit 97bd4a7

Browse files
committed
Always enable static export and basePath
Simplify Next.js config by removing isProd/isStaticExport conditionals. Force output: "export", always enable trailingSlash and skipTrailingSlashRedirect, and set basePath/assetPrefix from NEXT_PUBLIC_BASE_PATH (default "/plugins-doc-site"). Also set images.unoptimized to true. These changes make the GitHub Pages / static export settings unconditional and simplify basePath resolution.
1 parent 9ce7044 commit 97bd4a7

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

next.config.mjs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,20 @@ console.debug(` isProd: ${isProd}`);
1010
console.debug(` isStaticExport: ${isStaticExport}`);
1111

1212
// GitHub Pages configuration
13-
const basePath =
14-
isProd && isStaticExport
15-
? process.env.NEXT_PUBLIC_BASE_PATH || "/plugins-doc-site"
16-
: "";
13+
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || "/plugins-doc-site";
1714

1815
/** @type {import('next').NextConfig} */
1916
const config = {
20-
output: isProd || isStaticExport ? "export" : undefined,
17+
output: "export",
2118
reactStrictMode: true,
22-
...(isStaticExport && {
23-
trailingSlash: true,
24-
skipTrailingSlashRedirect: true,
25-
basePath: basePath,
26-
assetPrefix: basePath,
27-
}),
19+
20+
trailingSlash: true,
21+
skipTrailingSlashRedirect: true,
22+
basePath: basePath,
23+
assetPrefix: basePath,
24+
2825
images: {
29-
unoptimized: isStaticExport, // Only unoptimize for static export
26+
unoptimized: true, // isStaticExport, // Only unoptimize for static export
3027
remotePatterns: [
3128
{
3229
hostname: "github.com",

0 commit comments

Comments
 (0)