-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
94 lines (89 loc) · 2.53 KB
/
next.config.ts
File metadata and controls
94 lines (89 loc) · 2.53 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
import type { NextConfig } from 'next';
import withBundleAnalyzer from '@next/bundle-analyzer';
import { withSentryConfig } from '@sentry/nextjs';
import { z } from 'zod';
import packageJson from './package.json';
// Validate public env vars at build/dev start (never ships to client bundle)
z.object({
NEXT_PUBLIC_FRONTEND_URL: z.url(),
NEXT_PUBLIC_MW_URL: z.url(),
NEXT_PUBLIC_PRIVY_APP_ID: z.string().min(1),
}).parse({
NEXT_PUBLIC_FRONTEND_URL: process.env.NEXT_PUBLIC_FRONTEND_URL,
NEXT_PUBLIC_MW_URL: process.env.NEXT_PUBLIC_MW_URL,
NEXT_PUBLIC_PRIVY_APP_ID: process.env.NEXT_PUBLIC_PRIVY_APP_ID,
});
const nextConfig: NextConfig = {
output: 'standalone',
serverExternalPackages: ['pdf-parse'],
env: {
NEXT_PUBLIC_APP_VERSION: packageJson.version,
},
reactCompiler: true,
webpack: (config, { isServer }) => {
if (!isServer) {
config.optimization.splitChunks = {
...config.optimization.splitChunks,
cacheGroups: {
...config.optimization.splitChunks?.cacheGroups,
privy: {
test: /[\\/]node_modules[\\/](@privy-io|@walletconnect|@coinbase[\\/]wallet-sdk|viem|ox|abitype|@headlessui|styled-components|@noble|multiformats|uint8arrays|@msgpack|blakejs)[\\/]/,
name: 'privy-sdk',
chunks: 'all',
priority: 50,
enforce: true,
},
ui: {
test: /[\\/]src[\\/]components[\\/]ui[\\/]/,
name: 'ui-components',
chunks: 'all',
priority: 40,
enforce: true,
},
},
};
}
return config;
},
images: {
qualities: [25, 50, 75, 100],
remotePatterns: [
{
protocol: 'https',
hostname: 'www.google.com',
},
],
},
experimental: {
staticGenerationRetryCount: 1,
staticGenerationMaxConcurrency: 1,
staticGenerationMinPagesPerWorker: 13000,
},
redirects: async () => [
{
source: '/jobs',
destination: '/',
permanent: true,
},
],
};
const analyze = withBundleAnalyzer({
enabled: process.env.ANALYZE_BUNDLE === 'true',
});
export default withSentryConfig(analyze(nextConfig), {
org: 'jobstash',
project: 'webapp',
silent: !process.env.CI,
authToken: process.env.SENTRY_AUTH_TOKEN,
bundleSizeOptimizations: {
excludeDebugStatements: true,
excludeTracing: true,
excludeReplayIframe: true,
excludeReplayShadowDom: true,
excludeReplayWorker: true,
},
sourcemaps: {
deleteSourcemapsAfterUpload: true,
},
widenClientFileUpload: true,
});