forked from sambecker/exif-photo-blog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
40 lines (34 loc) · 1.08 KB
/
next.config.js
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
const VERCEL_BLOB_STORE_ID = process.env.BLOB_READ_WRITE_TOKEN?.match(
/^vercel_blob_rw_([a-z0-9]+)_[a-z0-9]+$/i,
)?.[1].toLowerCase();
const VERCEL_BLOB_HOSTNAME = VERCEL_BLOB_STORE_ID
? `${VERCEL_BLOB_STORE_ID}.public.blob.vercel-storage.com`
: undefined;
const AWS_S3_HOSTNAME =
process.env.NEXT_PUBLIC_AWS_S3_BUCKET &&
process.env.NEXT_PUBLIC_AWS_S3_REGION
// eslint-disable-next-line max-len
? `${process.env.NEXT_PUBLIC_AWS_S3_BUCKET}.s3.${process.env.NEXT_PUBLIC_AWS_S3_REGION}.amazonaws.com`
: undefined;
const createRemotePattern = (hostname) => hostname
? {
protocol: 'https',
hostname,
port: '',
pathname: '/**',
}
: [];
/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
imageSizes: [200],
remotePatterns: []
.concat(createRemotePattern(VERCEL_BLOB_HOSTNAME))
.concat(createRemotePattern(AWS_S3_HOSTNAME)),
minimumCacheTTL: 31536000,
},
};
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
module.exports = withBundleAnalyzer(nextConfig);