-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
70 lines (67 loc) · 1.95 KB
/
Copy pathnext.config.js
File metadata and controls
70 lines (67 loc) · 1.95 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
/**
* @type { import('next').NextConfig }
*/
/**
* Host the geostory covers are served from (see `getGeostoryImageUrl`). Read from
* the env so a preview pointed at another media server is still allowed by the
* image optimizer; falls back to production.
*/
const mediaHost = (() => {
try {
return new URL(process.env.NEXT_PUBLIC_API_IMAGES_URL || 'https://api.earthmonitor.org')
.hostname;
} catch {
return 'api.earthmonitor.org';
}
})();
const nextConfig = {
reactStrictMode: false,
// Configure pageExtensions to include md and mdx
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
poweredByHeader: false,
env: {
API_URL: process.env.API_URL,
},
images: {
// Geostory covers come from the API as multi-megabyte JPEGs (one is 23 MiB)
// and are shown at 79px; Fosstodon avatars and previews are 400px+ shown at
// 56px. Letting Next resize and re-encode them is the single biggest saving
// on the landing page, so the optimizer stays on.
remotePatterns: [
{
protocol: 'https',
hostname: mediaHost,
pathname: '/media/**',
},
{
protocol: 'https',
hostname: 'cdn.fosstodon.org',
},
{
protocol: 'https',
hostname: 'fosstodon.org',
},
{
protocol: 'https',
hostname: 'cdn.mstdn.social',
},
{
protocol: 'http',
hostname: '0.0.0.0',
},
{
protocol: 'http',
hostname: 'localhost',
},
],
// Next 16 only encodes the qualities listed here. 75 is the default; 90 is
// for the small geostory covers, where compression softness shows.
qualities: [75, 90],
// Covers and avatars change rarely; keep the optimized variants for 30 days
// rather than the default 4 hours so repeat loads never hit the origin.
minimumCacheTTL: 60 * 60 * 24 * 30,
},
output: 'standalone',
transpilePackages: ['ol'],
};
module.exports = nextConfig;