-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.mjs
More file actions
70 lines (63 loc) · 2.55 KB
/
next.config.mjs
File metadata and controls
70 lines (63 loc) · 2.55 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
import { withSentryConfig } from "@sentry/nextjs";
/** @type {import('next').NextConfig} */
const nextConfig = {
typescript: {
ignoreBuildErrors: false,
},
eslint: {
ignoreDuringBuilds: true,
},
async headers() {
return [
{
source: '/tiles/:path*',
headers: [
{ key: 'Cache-Control', value: 'public, max-age=31536000, immutable' },
{ key: 'Content-Type', value: 'application/x-protobuf' },
],
},
];
},
async rewrites() {
return {
// afterFiles rewrites only trigger when no static file matches,
// so zoom 0-10 (static tiles) are served directly, zoom 11+
// falls through to the API route for dynamic generation.
afterFiles: [
// Territories
{ source: '/tiles/territories/:z/:x/:y.pbf', destination: '/api/tiles/territories/:z/:x/:y' },
{ source: '/tiles/territories/:z/:x/:y', destination: '/api/tiles/territories/:z/:x/:y' },
// Power plants
{ source: '/tiles/power-plants/:z/:x/:y.pbf', destination: '/api/tiles/power-plants/:z/:x/:y' },
{ source: '/tiles/power-plants/:z/:x/:y', destination: '/api/tiles/power-plants/:z/:x/:y' },
// EV charging stations
{ source: '/tiles/ev-charging/:z/:x/:y.pbf', destination: '/api/tiles/ev-charging/:z/:x/:y' },
{ source: '/tiles/ev-charging/:z/:x/:y', destination: '/api/tiles/ev-charging/:z/:x/:y' },
// Transmission lines
{ source: '/tiles/transmission-lines/:z/:x/:y.pbf', destination: '/api/tiles/transmission-lines/:z/:x/:y' },
{ source: '/tiles/transmission-lines/:z/:x/:y', destination: '/api/tiles/transmission-lines/:z/:x/:y' },
// Pricing nodes
{ source: '/tiles/pricing-nodes/:z/:x/:y.pbf', destination: '/api/tiles/pricing-nodes/:z/:x/:y' },
{ source: '/tiles/pricing-nodes/:z/:x/:y', destination: '/api/tiles/pricing-nodes/:z/:x/:y' },
],
};
},
};
export default withSentryConfig(nextConfig, {
// Upload source maps to Sentry for readable stack traces
org: "texture",
project: "commongrid",
authToken: process.env.SENTRY_AUTH_TOKEN,
// Suppress source map upload logs
silent: !process.env.CI,
// Don't fail the build if source map upload fails (e.g. missing auth token)
errorHandler: (err) => {
console.warn('Sentry source map upload warning:', err.message);
},
// Automatically tree-shake Sentry logger statements
disableLogger: true,
// Hide source maps from users
hideSourceMaps: true,
// Widen upload scope to include utility modules
widenClientFileUpload: true,
});