Skip to content

Commit acd0750

Browse files
committed
Add basePath and assetPrefix for production builds
Configured basePath and assetPrefix in next.config.ts to use the repository name when in production. This ensures correct asset loading and routing for static exports hosted under a subpath.
1 parent 4919a65 commit acd0750

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

web/next.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import type { NextConfig } from "next";
22

3+
const isProd = process.env.NODE_ENV === 'production';
4+
const repoName = 'tarot-but-hours'; // 如果您的仓库名不是这个,请修改此处
5+
36
const nextConfig: NextConfig = {
47
output: 'export',
8+
basePath: isProd ? `/${repoName}` : '',
9+
assetPrefix: isProd ? `/${repoName}/` : '',
510
images: {
611
unoptimized: true,
712
},

0 commit comments

Comments
 (0)