-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.js
More file actions
77 lines (75 loc) · 2.77 KB
/
Copy pathnext.config.js
File metadata and controls
77 lines (75 loc) · 2.77 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
const webpack = require("webpack");
/** @type {import('next').NextConfig} */
const nextConfig = {
// Strip moment.js non-English locales from the client bundle. Moment
// pulls in ~50–80KB of locale data we never use (the dashboard calendar
// is the only moment consumer and it's English-only). When we migrate
// off moment to date-fns this plugin becomes unnecessary; until then
// it's the cheapest bundle win available.
webpack: (config) => {
config.plugins.push(
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment$/,
}),
);
return config;
},
rewrites: async () => {
return [
// Serve OG preview images from a public path that is NOT under /api/.
// The handlers live at app/api/og/* but robots.txt disallows /api/, and
// some social crawlers (notably Twitter/X) don't reliably honor an
// `Allow: /api/og/` override of that broader `Disallow: /api/`. Exposing
// the same handlers under /og/* sidesteps robots entirely for every
// crawler — /og/ isn't under any disallowed path. Query strings pass
// through automatically. The old /api/og/* URLs still work too, so
// already-cached social cards don't break.
{ source: "/og", destination: "/api/og" },
{ source: "/og/:path*", destination: "/api/og/:path*" },
];
},
redirects: async () => {
return [
{
source: "/github",
destination: "https://github.com/afonsocrg/adamastor",
permanent: true,
},
{
source: "/linkedin",
destination: "https://linkedin.com/company/adamastor-magazine/",
permanent: true,
},
// Consolidate inbound link equity from the legacy query-param filter
// URLs onto the new route-segment URLs. Order matters — the most
// specific match must come first, otherwise /events?city=lisboa&category=design
// would match the city-only rule and drop the category param.
{
source: "/events",
has: [
{ type: "query", key: "city", value: "(?<city>.+)" },
{ type: "query", key: "category", value: "(?<category>.+)" },
],
destination: "/events/:city/:category",
permanent: true,
},
{
source: "/events",
has: [{ type: "query", key: "city", value: "(?<city>.+)" }],
missing: [{ type: "query", key: "category" }],
destination: "/events/:city",
permanent: true,
},
{
source: "/events",
has: [{ type: "query", key: "category", value: "(?<category>.+)" }],
missing: [{ type: "query", key: "city" }],
destination: "/events/:category",
permanent: true,
},
];
},
productionBrowserSourceMaps: true,
};
module.exports = nextConfig;