-
Notifications
You must be signed in to change notification settings - Fork 6
/
next.config.js
95 lines (89 loc) · 2.77 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
import { config as appConfig } from 'node-config-ts';
import { NodeConfigTSPlugin } from 'node-config-ts/webpack.js';
import { StatsWriterPlugin } from 'webpack-stats-plugin';
import { logger } from './dist/server/logger.js';
if (!appConfig.applicationURL && !process.env.NEXTAUTH_URL) {
throw new Error('Missing external application URL (config.applicationUrl)');
} else if (!process.env.NEXTAUTH_URL) {
process.env.NEXTAUTH_URL = appConfig.applicationURL;
}
const { enabledLocales } = appConfig;
let defaultLocale = 'en';
if (enabledLocales.includes(appConfig.defaultLocale)) {
defaultLocale = appConfig.defaultLocale;
}
logger.info(`Default locale: ${defaultLocale}`);
logger.info(`Enabled locales: ${enabledLocales}`);
logger.info(`Environment: ${process.env.NODE_ENV}`);
/** @type {import('next').NextConfig} */
// eslint-disable-next-line import/no-anonymous-default-export
export default {
output: undefined,
poweredByHeader: false,
reactStrictMode: true,
swcMinify: true,
webpack: (config) => {
config.plugins.push(
new StatsWriterPlugin({
filename: 'stats.json',
stats: {
context: './src', // optional, will improve readability of the paths
assets: true,
entrypoints: true,
chunks: true,
modules: true,
},
}),
);
return NodeConfigTSPlugin(config);
},
i18n: {
locales: enabledLocales,
defaultLocale,
localeDetection: false,
},
async redirects() {
return [
{
source: '/leaderboard/day',
destination: '/day',
permanent: true,
},
{
source: '/leaderboard/week',
destination: '/week',
permanent: true,
},
{
source: '/leaderboard/month',
destination: '/month',
permanent: true,
},
];
},
experimental: {
cpus: 1,
outputFileTracingIncludes: {
'/': ['config/**/*.json', 'dist/**/*.js'],
'/(day|week|month)': ['config/**/*.json', 'dist/**/*.js'],
'/profile/**': ['config/**/*.json', 'dist/**/*.js'],
'/api/**': [
'node_modules/cron/package.json',
'node_modules/cron/lib/*.js',
'node_modules/luxon/package.json',
'node_modules/luxon/build/node/luxon.js',
'node_modules/tslog/package.json',
'node_modules/tslog/dist/cjs/**/*.js',
'node_modules/tslog/dist/esm/**/*.js',
'node_modules/tslog/dist/browser/*.js',
'node_modules/source-map-support/package.json',
'node_modules/source-map-support/source-map-support.js',
'node_modules/source-map/package.json',
'node_modules/source-map/source-map.js',
'node_modules/source-map/lib/*.js',
'node_modules/buffer-from/package.json',
'node_modules/buffer-from/index.js',
],
},
},
};