-
Notifications
You must be signed in to change notification settings - Fork 1
/
next.config.js
39 lines (36 loc) · 1.14 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
const packageJson = require('./package.json');
const i18nRoutes = require('./i18nRoutes.config');
const { i18n } = require('./next-i18next.config');
const redirectCampaignRoutes = require('./redirectCampaignRoutes.config');
const redirectBackwardCompatibilityRoutes = require('./redirectBackwardCompatibilityRoutes.config');
const nextBaseConfig = require('../../next.base.config');
const campaignRoutes = Object.entries(redirectCampaignRoutes).flatMap(
([source, destination]) => [
{
// Not setting `locale: false` here because that didn't work for some reason.
// When locale is left undefined middleware.ts's prefixDefaultLocale function
// lets these redirect routes through without prefixing them with locale.
source,
destination,
permanent: true,
},
]
);
const backwardRoutes = Object.entries(
redirectBackwardCompatibilityRoutes
).flatMap(([source, destination]) => [
{
source,
destination,
permanent: true,
locale: false,
},
]);
module.exports = nextBaseConfig({
packageJson,
i18nRoutes,
i18n,
async redirects() {
return [...campaignRoutes, ...backwardRoutes];
},
});