-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathnext.config.js
44 lines (40 loc) · 1.17 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
const locales = ['en', 'ru', 'ar'];
const defaultLocale = 'en';
// noinspection JSUnusedGlobalSymbols
const nextconfig = {
// Target must be serverless
env: {
basePath: process.env.BASE_PATH || '',
},
basePath: process.env.BASE_PATH || '',
async rewrites() {
return [
...locales.filter((locale) => locale !== defaultLocale).map((locale) => [
{ source: `/${locale}{/}?`, destination: '/' },
{ source: `/${locale}/:path*`, destination: '/:path*' },
]).reduce((acc, cur) => [...acc, ...cur], []),
];
},
async redirects() {
return [
{
source: `/${defaultLocale}{/}?`,
destination: '/',
permanent: true,
},
{
source: `/${defaultLocale}/:path*`,
destination: '/:path*',
permanent: true,
},
];
},
};
// next.config.js
const withPlugins = require('next-compose-plugins');
const optimizedImages = require('next-optimized-images');
module.exports = withPlugins([
[optimizedImages],
// your other plugins here
nextconfig
]);