-
Notifications
You must be signed in to change notification settings - Fork 1
/
next.config.mjs
63 lines (58 loc) · 1.47 KB
/
next.config.mjs
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
import { env } from "./src/env/server.mjs";
import withBundleAnalyzer from "@next/bundle-analyzer";
import { withSentryConfig } from "@sentry/nextjs";
import * as pack from './package.json' assert { type: "json" };
/**
* Don't be scared of the generics here.
* All they do is to give us autocompletion when using this.
*
* @template {import("next").NextConfig} T
* @param {T} config - A generic parameter that flows through to the return type
* @constraint {{import("next").NextConfig}}
*/
function defineNextConfig(config) {
// https://stackoverflow.com/a/68437008/6912830
const bundleAnalyzer = withBundleAnalyzer({
enabled: process.env.ANALYZE === "true",
});
if (process.env.NODE_ENV !== "development")
return withSentryConfig(bundleAnalyzer(config), {silent: true});
return bundleAnalyzer(config);
}
export const nextConfig = {
reactStrictMode: true,
swcMinify: true,
// Next.js i18n docs: https://nextjs.org/docs/advanced-features/i18n-routing
i18n: {
locales: ["en"],
defaultLocale: "en",
},
async redirects() {
return [
{
source: '/tos',
destination: '/terms-of-service',
permanent: true
}
]
},
// TODO: Remove this once we don't use external images
images: {
remotePatterns: [
{
protocol: "https",
hostname: "**.*",
},
],
},
sentry: {
hideSourceMaps: true
},
experimental: {
appDir: false
},
publicRuntimeConfig: {
version: pack.default.version
}
};
export default defineNextConfig(nextConfig);