-
Notifications
You must be signed in to change notification settings - Fork 2
/
next.config.js
127 lines (120 loc) · 3.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
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
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful
* for Docker builds.
*/
await import("./src/env.js");
/** @type {import("./src/browser/i18n/locales").default} */
const locales = [
{"locale": "en", "lang": "English"},
{"locale": "es", "lang": "Español"},
{"locale": "pt-br", "lang": "Português do Brasil"},
{"locale": "de", "lang": "Deutsch"},
{"locale": "fr", "lang": "Français"},
{"locale": "he", "lang": "עִבְרִית"},
{"locale": "ja", "lang": "日本語"},
{"locale": "it", "lang": "Italiano"},
{"locale": "nl", "lang": "Nederlands"},
{"locale": "ru", "lang": "Русский"},
{"locale": "tr", "lang": "Türkçe"},
{"locale": "id", "lang": "Bahasa Indonesia"},
{"locale": "zh-cn", "lang": "简体中文"},
{"locale": "zh-tw", "lang": "繁體中文"},
{"locale": "ko", "lang": "한국어"},
{"locale": "ar", "lang": "العربية"},
{"locale": "sv", "lang": "Svenska"}
];
// TODO more restrictive? This is added because we need to iframe umami
const contentSecurityPolicy = [
`default-src * data:`,
`img-src * blob: data:`,
`script-src * 'unsafe-eval' 'unsafe-inline'`,
`style-src * 'unsafe-inline'`,
`frame-src *`,
`worker-src * data: blob:`,
];
/** @type {import("next").NextConfig} */
const config = {
reactStrictMode: true,
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'imgcdn.wolio.co',
port: '',
pathname: '/**',
},
],
},
async redirects() {
return [
{
source: '/dash',
destination: '/dash/sites',
permanent: false,
},
{
source: '/start',
destination: '/templates',
permanent: true, // For 301 redirect
// handle locales automatically
},
]
},
// async rewrites() {
// return [
// {
// source: '/auth/:path*',
// destination: '/api/auth/:path*'
// },
// ]
// },
eslint: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has lint errors.
// !! WARN !!
// ignoreDuringBuilds: true,
},
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
// ignoreBuildErrors: true,
},
/**
* If you are using `appDir` then you must comment the below `i18n` config out.
*
* @see https://github.com/vercel/next.js/issues/41980
*/
i18n: {
// TODO ts checks here?
locales: locales.map(v => v.locale),
defaultLocale: "en",
},
pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
webpack: (config, { isServer }) => {
// Fixes npm packages (mdx) that depend on `fs` module
if (!isServer) {
config.resolve.fallback.fs = false
}
return config
},
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Content-Security-Policy',
value: contentSecurityPolicy
.join(';')
.replace(/\s{2,}/g, ' ')
.trim(),
},
],
},
]
},
};
export default config;