-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.ts
53 lines (45 loc) · 1.27 KB
/
next.config.ts
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
import { NextConfig } from 'next';
import webpack from 'webpack';
const mode: NextConfig['output'] = process.env.BUILD_MODE as NextConfig['output'] ?? 'standalone';
console.log('[Next] build mode', mode);
const disableChunk = !!process.env.DISABLE_CHUNK || mode === 'export';
console.log('[Next] build with chunk: ', !disableChunk);
const nextConfig: NextConfig = {
webpack(config) {
if (disableChunk) {
config.plugins.push(new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }));
}
config.resolve.fallback = {
child_process: false
};
return config;
},
output: mode,
images: {
unoptimized: mode === 'export'
},
experimental: {
forceSwcTransforms: true
},
reactStrictMode: false,
sassOptions: {
api: 'modern-compiler',
silenceDeprecations: ['legacy-js-api'],
}
};
if (mode !== 'export') {
nextConfig.redirects = async () => [
{
source: '/',
destination: '/home',
permanent: true,
},
];
nextConfig.rewrites = async () => [
{
source: '/api/vodhub/:path*',
destination: 'http://127.0.0.1:8888/api/vodhub/:path*',
}
];
}
export default nextConfig;