-
Notifications
You must be signed in to change notification settings - Fork 667
Expand file tree
/
Copy pathnext.config.mjs
More file actions
59 lines (54 loc) · 2.28 KB
/
Copy pathnext.config.mjs
File metadata and controls
59 lines (54 loc) · 2.28 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
import { withSentryConfig } from '@sentry/nextjs';
import { withBotId } from 'botid/next/config';
import { fileURLToPath } from 'url';
import { buildRedirects } from './config/redirects.mjs';
import { createSentryBuildConfig } from './sentry/config.mjs';
// Pin both file-tracing and Turbopack to the project root; otherwise Next walks up to a parent
// pnpm-workspace.yaml (e.g. in git worktrees) and the two roots disagree.
const projectRoot = fileURLToPath(new URL('.', import.meta.url));
/** @type {import('next').NextConfig} */
const nextConfig = {
// Use separate build directory for dev server to avoid conflicts with production builds
distDir: process.env.NODE_ENV === 'production' ? '.next' : '.next-dev',
outputFileTracingRoot: projectRoot,
images: {
remotePatterns: [
{
hostname: 'raw.githubusercontent.com',
pathname: '/solana-labs/token-list/main/assets/**',
port: '',
protocol: 'https',
},
],
},
// bigint-buffer loads its native .node via `bindings`, which walks up from the module's real
// path — bundling it breaks that lookup and forces the pure-JS fallback warning.
serverExternalPackages: ['bigint-buffer'],
async headers() {
const seoFileHeaders = [
{
key: 'Cache-Control',
value: 'public, max-age=3600, stale-while-revalidate=86400',
},
];
return [
{ source: '/robots.txt', headers: seoFileHeaders },
{ source: '/sitemap.xml', headers: seoFileHeaders },
{ source: '/default-sitemap.xml', headers: seoFileHeaders },
{ source: '/accounts-sitemap.xml', headers: seoFileHeaders },
];
},
async redirects() {
return buildRedirects();
},
turbopack: {
root: projectRoot,
resolveAlias: {
// resolve-domain.ts uses deserializeUnchecked, removed in borsh@2 (also installed as borsh2).
borsh: './node_modules/borsh',
// @coral-xyz/anchor's nodewallet/workspace require('fs'), but those paths never run in the browser.
fs: { browser: './empty.ts' },
},
},
};
export default withBotId(withSentryConfig(nextConfig, createSentryBuildConfig()));