-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathnext.config.mjs
More file actions
127 lines (120 loc) · 3.27 KB
/
next.config.mjs
File metadata and controls
127 lines (120 loc) · 3.27 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
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
117
118
119
120
121
122
123
124
125
126
127
import withBundleAnalyzer from '@next/bundle-analyzer';
import { createJiti } from 'jiti';
const jiti = createJiti(new URL(import.meta.url).pathname);
await jiti.import('./src/utils/env');
// Import centralized pagination redirect logic
const { generatePaginationConfigRedirects } = await jiti.import('./src/utils/pagination-redirects');
// Redirect legacy post paths to the new pattern
const oldPostPaths = [
'/why-fathom-analytics',
'/on-normalcy',
'/plan-for-things-to-go-wrong-in-your-web-app',
'/are-you-suddenly-a-remote-worker',
'/crosspost-introducing-pistola',
'/gatsby-dev-to-cross-poster-brainstorm',
'/i-have-to-tell-you-about-dependabot',
'/all-about-ch',
'/promise-all-settled-pt-2-its-partly-settled',
'/picking-apart-javascript-import',
'/solve-all-your-problems-with-promise-allsettled',
'/reclaimed-10gb-of-disk-space-from-node-modules',
'/sticker-update-we-raised-176-nzd',
'/deconfusing-javascript-destructuring-syntax',
'/quick-tip-uninstall-postgres-from-your-mac',
'/egg-them-all',
'/chrome-extensions-i-use',
'/my-favorite-design-problem-microphones',
'/embracing-prettier',
'/it-was-time',
'/tech-product-growth-wabi-sabi',
'/naming-your-product-kiki-bouba',
'/design-decisions-cafe-tables',
];
const postRedirects = oldPostPaths.map((path) => ({
source: path,
destination: `/posts${path}`,
permanent: false,
}));
/**
* @type {import('next').NextConfig}
**/
const config = {
reactCompiler: true,
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'i.ytimg.com',
},
{
protocol: 'https',
hostname: 'res.cloudinary.com',
},
{
protocol: 'https',
hostname: 'images.unsplash.com',
},
{
protocol: 'https',
hostname: 'webmention.io',
},
{
protocol: 'https',
hostname: 'images.unsplash.com',
},
],
},
productionBrowserSourceMaps: false,
skipTrailingSlashRedirect: true,
redirects: async () => [
{
source: '/meet',
destination: 'https://savvycal.com/irreverentmike/30m',
permanent: false,
},
{
source: '/meet/pod',
destination: 'https://savvycal.com/irreverentmike/pod',
permanent: false,
},
{
source: '/sponsor',
destination: 'https://www.passionfroot.me/irreverentmike',
permanent: false,
},
{
source: '/tinyimprovements',
destination: '/newsletter',
permanent: false,
},
...generatePaginationConfigRedirects(),
...postRedirects,
],
rewrites: async () => [
{
source: '/ingest/static/:path*',
destination: 'https://us-assets.i.posthog.com/static/:path*',
},
{
source: '/ingest/:path*',
destination: 'https://us.i.posthog.com/:path*',
},
{
source: '/ingest/decide',
destination: 'https://us.i.posthog.com/decide',
},
],
turbopack: {},
webpack: (config, { dev, isServer: _ }) => {
// Only apply webpack config when not using turbopack
if (!dev) {
return config;
}
if (dev) {
config.optimization.minimize = false;
}
return config;
},
};
export default withBundleAnalyzer({ enabled: process.env.ANALYZE === 'true' })(config);