/
next.config.js
170 lines (166 loc) · 4.48 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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
const withNextra = require("nextra")({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.js",
unstable_flexsearch: true,
unstable_staticImage: true,
});
const OLD_TURBOREPO_ROUTES = [
"/docs",
"/docs/ci/circleci",
"/docs/ci/github-actions",
"/docs/ci/gitlabci",
"/docs/ci/travisci",
"/docs/core-concepts/caching",
"/docs/core-concepts/remote-caching",
"/docs/core-concepts/scopes",
"/docs/core-concepts/monorepos/filtering",
"/docs/core-concepts/monorepos/running-tasks",
"/docs/getting-started/create-new",
"/docs/getting-started/existing-monorepo",
"/docs/handbook",
"/docs/handbook/building-your-app",
"/docs/handbook/deploying-with-docker",
"/docs/handbook/dev",
"/docs/handbook/linting",
"/docs/handbook/migrating-to-a-monorepo",
"/docs/handbook/package-installation",
"/docs/handbook/publishing-packages",
"/docs/handbook/sharing-code",
"/docs/handbook/testing",
"/docs/handbook/troubleshooting",
"/docs/handbook/what-is-a-monorepo",
"/docs/handbook/workspaces",
"/docs/handbook/linting/eslint",
"/docs/handbook/linting/typescript",
"/docs/handbook/publishing-packages/bundling",
"/docs/handbook/publishing-packages/versioning-and-publishing",
"/docs/handbook/sharing-code/internal-packages",
"/docs/reference/codemods",
"/docs/reference/command-line-reference",
"/docs/reference/configuration",
"/docs/acknowledgements",
"/docs/ci",
"/docs/faq",
"/docs/troubleshooting",
"/docs/upgrading-to-v1",
];
const nextConfig = withNextra({
reactStrictMode: true,
experimental: {
legacyBrowsers: false,
},
images: {
unoptimized: true,
},
webpack: (config, { webpack }) => {
config.plugins.push(new webpack.DefinePlugin({}));
// return the modified config
return config;
},
rewrites() {
return {
beforeFiles: [
{
source: "/sitemap.xml",
destination:
"https://crawled-sitemap.vercel.sh/turbobuild-sitemap.xml",
},
],
};
},
async redirects() {
return [
...OLD_TURBOREPO_ROUTES.map((route) => ({
source: route,
destination: `/repo${route}`,
permanent: true,
})),
{
source: "/usage",
destination: "/repo/docs/reference/command-line-reference",
permanent: true,
},
{
source: "/docs/core-concepts/running-tasks",
destination: "/repo/docs/core-concepts/monorepos/running-tasks",
permanent: true,
},
{
source: "/docs/core-concepts/why-turborepo",
destination: "/repo/docs/core-concepts/monorepos",
permanent: true,
},
{
source: "/docs/core-concepts/filtering",
destination: "/repo/docs/core-concepts/monorepos/filtering",
permanent: true,
},
{
source: "/docs/guides/workspaces",
destination: "/docs/handbook/workspaces",
permanent: true,
},
{
source: "/docs/core-concepts/workspaces",
destination: "/docs/handbook/workspaces",
permanent: true,
},
{
source: "/docs/core-concepts/pipelines",
destination: "/docs/core-concepts/running-tasks",
permanent: true,
},
{
source: "/docs/guides/migrate-from-lerna",
destination: "/docs/handbook/migrating-to-a-monorepo",
permanent: true,
},
{
source: "/docs/getting-started",
destination: "/docs",
permanent: true,
},
{
source: "/discord{/}?",
permanent: true,
destination: "https://discord.gg/sSzyjxvbf5",
},
{
source: "/docs/changelog",
permanent: true,
destination: "https://github.com/vercel/turbo/releases",
},
{
source: "/docs/guides/complimentary-tools",
permanent: true,
destination: "/docs/handbook",
},
{
source: "/docs/guides/monorepo-tools",
permanent: true,
destination: "/docs/handbook",
},
{
source: "/docs/glossary",
permanent: true,
destination: "/docs/handbook",
},
{
source: "/docs/guides/continuous-integration",
permanent: true,
destination: "/docs/ci",
},
{
source: "/docs/features/:path*",
permanent: true,
destination: "/docs/core-concepts/:path*",
},
{
source: "/docs/:path*",
permanent: true,
destination: "/repo/docs/:path*",
},
];
},
});
module.exports = nextConfig;