-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathnext.config.mjs
More file actions
104 lines (98 loc) · 3.49 KB
/
next.config.mjs
File metadata and controls
104 lines (98 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import path from "path"
import { execSync } from "child_process"
// Inject git build info at build time
const getGitInfo = () => {
try {
const commitHash = execSync("git rev-parse HEAD").toString().trim();
const commitShort = execSync("git rev-parse --short HEAD").toString().trim();
const branch = execSync("git rev-parse --abbrev-ref HEAD").toString().trim();
const commitMessage = execSync("git log -1 --pretty=%s").toString().trim();
const commitDate = execSync("git log -1 --pretty=%ci").toString().trim();
return { commitHash, commitShort, branch, commitMessage, commitDate };
} catch {
return { commitHash: "unknown", commitShort: "unknown", branch: "unknown", commitMessage: "", commitDate: "" };
}
};
const gitInfo = getGitInfo();
/** @type {import('next').NextConfig} */
const nextConfig = {
env: {
NEXT_PUBLIC_GIT_COMMIT_HASH: gitInfo.commitHash,
NEXT_PUBLIC_GIT_COMMIT_SHORT: gitInfo.commitShort,
NEXT_PUBLIC_GIT_BRANCH: gitInfo.branch,
NEXT_PUBLIC_GIT_COMMIT_MESSAGE: gitInfo.commitMessage,
NEXT_PUBLIC_GIT_COMMIT_DATE: gitInfo.commitDate,
NEXT_PUBLIC_BUILD_TIME: new Date().toISOString(),
NEXT_PUBLIC_REPO_URL: "https://github.com/gobitsnbytes/bitsnbytes",
},
typescript: {
ignoreBuildErrors: true,
},
serverExternalPackages: ["sharp", "onnxruntime-node"],
images: {
// Enable image optimization for Vercel
domains: [],
qualities: [60, 75, 85, 90],
formats: ['image/avif', 'image/webp'],
remotePatterns: [
{
protocol: 'https',
hostname: '**',
},
],
},
// Enable React strict mode for better development
reactStrictMode: true,
// Production source maps for better debugging
productionBrowserSourceMaps: false,
// Compress output
compress: true,
turbopack: {
// Explicitly set the Turbopack root to the project root
root: process.cwd(),
},
webpack(config) {
if (!config.resolve) {
config.resolve = {}
}
config.resolve.alias = {
...(config.resolve.alias ?? {}),
"@public": path.resolve("./public"),
}
return config
},
async headers() {
return [
{
source: '/:path*',
headers: [
{
key: 'X-DNS-Prefetch-Control',
value: 'on'
},
{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload'
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN'
},
{
key: 'X-Content-Type-Options',
value: 'nosniff'
},
{
key: 'Referrer-Policy',
value: 'origin-when-cross-origin'
},
{
key: 'Content-Security-Policy',
value: "default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://va.vercel-scripts.com https://tally.so https://hcaptcha.com https://*.hcaptcha.com https://static.cloudflareinsights.com; style-src 'self' 'unsafe-inline' https://hcaptcha.com https://*.hcaptcha.com; img-src 'self' blob: data: https:; font-src 'self' data: https://r2cdn.perplexity.ai; connect-src 'self' https://vitals.vercel-insights.com https://hcaptcha.com https://*.hcaptcha.com https://*.supabase.co https://cloudflareinsights.com; frame-src 'self' https://tally.so https://hcaptcha.com https://*.hcaptcha.com https://discord.com https://*.discord.com https://*.notion.site https://www.notion.so;"
}
]
}
]
},
}
export default nextConfig