-
-
Notifications
You must be signed in to change notification settings - Fork 169
Expand file tree
/
Copy pathnext.config.js
More file actions
94 lines (87 loc) · 2.48 KB
/
Copy pathnext.config.js
File metadata and controls
94 lines (87 loc) · 2.48 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
/** @type {import('next').NextConfig} */
const withMDX = require("@next/mdx")();
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
const REMOTE_PATTERNS = [
"images.ctfassets.net",
"images.unsplash.com",
"avatars.githubusercontent.com",
"www.gravatar.com",
// Seed/placeholder avatars + cover images used by dev/e2e fixtures.
"robohash.org",
"picsum.photos",
"i.pravatar.cc",
// Temporary wildcard
"*.s3.eu-west-1.amazonaws.com",
"s3.eu-west-1.amazonaws.com",
].map((hostname) => ({
hostname,
protocol: "https",
}));
const config = {
async redirects() {
return [
{
source: "/newsletter",
destination: "https://newsletter.codu.co",
permanent: true,
},
{
source: "/newsletter/:path*",
destination: "https://newsletter.codu.co",
permanent: true,
},
// Legacy feed article URLs -> /s/ namespace (one hop, no redirect chain).
{
source: "/feed/:sourceSlug/:articleId",
destination: "/s/:sourceSlug/:articleId",
permanent: true,
},
// Legacy feed source URLs -> /s/ namespace.
{
source: "/feed/:sourceSlug",
destination: "/s/:sourceSlug",
permanent: true,
},
// Deleted course pages and the removed /alpha section — send home
// rather than hard-404 previously-resolvable URLs.
{
source: "/courses/:path*",
destination: "/",
permanent: true,
},
{
source: "/alpha/:path*",
destination: "/",
permanent: true,
},
];
},
// Turbopack configuration for SVGR (replaces webpack config)
turbopack: {
rules: {
"*.svg": {
loaders: ["@svgr/webpack"],
as: "*.js",
},
},
},
pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"],
// Never serve trailing-slash variants (Next 301s `/foo/` -> `/foo`).
trailingSlash: false,
images: {
remotePatterns: REMOTE_PATTERNS,
},
// Note: i18n is not supported in App Router - use middleware for i18n instead
// Note: experimental.instrumentationHook is now auto-detected in Next.js 16
// Note: typescript.ignoreBuildErrors removed - fixing TS errors as part of upgrade
};
// Injected content via Sentry wizard below
const { withSentryConfig } = require("@sentry/nextjs");
module.exports = withSentryConfig(withMDX(withBundleAnalyzer(config)), {
silent: true,
org: "codu",
project: "codu",
hideSourceMaps: true,
});