-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
116 lines (113 loc) · 2.45 KB
/
next.config.mjs
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import withPlaiceholder from '@plaiceholder/next';
import { createContentlayerPlugin } from 'next-contentlayer';
import { createSecureHeaders } from 'next-secure-headers';
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
poweredByHeader: false,
env: {
NEXT_TELEMETRY_DISABLED: '1',
},
experimental: {
serverComponentsExternalPackages: ['linkedom'],
useLightningcss: true,
},
images: {
formats: ['image/avif', 'image/webp'],
remotePatterns: [
{
protocol: 'https',
hostname: 'eatmon.co',
pathname: '/**/*',
},
{
protocol: 'https',
hostname: 'a.ltrbxd.com',
pathname: '/resized/**/*',
},
{
protocol: 'https',
hostname: 'assets.literal.club',
pathname: '/**/*',
},
],
},
async headers() {
return [
{
source: '/(.*)',
headers: createSecureHeaders({
forceHTTPSRedirect: [true, { maxAge: 63072000, includeSubDomains: true, preload: true }],
}),
},
];
},
async redirects() {
return [
{
source: '/github',
destination: 'https://github.com/johneatmon',
permanent: true,
},
{
source: '/x',
destination: 'https://twitter.com/johneatmon_',
permanent: true,
},
{
source: '/cv',
destination: 'https://read.cv/johneatmon',
permanent: true,
},
{
source: '/work/:slug*',
destination: 'https://read.cv/johneatmon',
permanent: false,
},
{
source: '/project/:slug*',
destination: 'https://read.cv/johneatmon/npsVXnwnPLc03Cfs6863',
permanent: false,
},
{
source: '/about',
destination: '/',
permanent: false,
},
{
source: '/about/colophon',
destination: '/colophon',
permanent: true,
},
{
source: '/about/tools',
destination: '/blog/things-i-use',
permanent: true,
},
];
},
webpack: (config) => {
config.infrastructureLogging = {
level: 'error',
};
const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.('.svg'));
config.module.rules.push(
{
...fileLoaderRule,
test: /\.svg$/i,
resourceQuery: /url/, // *.svg?url
},
{
test: /\.svg$/i,
issuer: fileLoaderRule.issuer,
resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] },
use: ['@svgr/webpack'],
}
);
fileLoaderRule.exclude = /\.svg$/i;
return config;
},
};
const withContentlayer = createContentlayerPlugin({});
const config = withPlaiceholder(withContentlayer(nextConfig));
export default config;