-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.js
76 lines (68 loc) · 2.21 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
const withBundleAnalyzer = require('@next/bundle-analyzer');
const { verifyEnvironment } = require('./expect-env');
verifyEnvironment();
module.exports = () => {
return withBundleAnalyzer({
enabled: process.env.ANALYZE === 'true'
})({
// ? https://nextjs.org/docs/messages/future-webpack5-moved-to-webpack5
webpack5: true,
// ? Renames the build dir "build" instead of ".next"
distDir: 'build',
// ? Webpack configuration
// ! Note that the webpack configuration is executed twice: once
// ! server-side and once client-side!
webpack: (config) => {
// ? These are aliases that can be used during JS import calls
// ! If changed, also update these aliases in tsconfig.json,
// ! jest.config.js, webpack.config.ts, and .eslintrc.js
config.resolve &&
(config.resolve.alias = {
...config.resolve.alias,
universe: `${__dirname}/src/`,
multiverse: `${__dirname}/lib/`,
externals: `${__dirname}/external-scripts/`,
types: `${__dirname}/types/`
});
return config;
},
// ? Select some environment variables defined in .env to push to the
// ? client.
// !! DO NOT PUT ANY SECRET ENVIRONMENT VARIABLES HERE !!
env: {
RESULTS_PER_PAGE: process.env.RESULTS_PER_PAGE,
IGNORE_RATE_LIMITS: process.env.IGNORE_RATE_LIMITS,
LOCKOUT_ALL_KEYS: process.env.LOCKOUT_ALL_KEYS,
DISALLOWED_METHODS: process.env.DISALLOWED_METHODS,
REQUESTS_PER_CONTRIVED_ERROR: process.env.REQUESTS_PER_CONTRIVED_ERROR,
MAX_CONTENT_LENGTH_BYTES: process.env.MAX_CONTENT_LENGTH_BYTES
},
async rewrites() {
return [
{
source: '/v1/:path*',
destination: '/api/v1/:path*'
},
{
source: '/v2/:path*',
destination: '/api/v2/:path*'
}
];
},
async headers() {
return [
{
// ? https://github.com/vercel/next.js/discussions/17991
source: '/(.*?)',
headers: [
{
// ! Prevents all SEO and hides site from search engines
key: 'X-Robots-Tag',
value: 'none'
}
]
}
];
}
});
};