-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.ts
79 lines (73 loc) · 1.87 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
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
import type { NextConfig } from "next";
import type { Configuration as WebpackConfig } from 'webpack';
/** @type {import('next').NextConfig} */
const config: NextConfig = {
images: {
unoptimized: true, // Disable image optimization for static export
},
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
// Configure webpack for JSON and optimize chunks
webpack: (config: WebpackConfig, { isServer }) => {
// Ensure module and rules exist
if (!config.module) config.module = { rules: [] };
if (!config.module.rules) config.module.rules = [];
config.module.rules.push({
test: /\.json$/,
type: 'json',
resolve: {
alias: {
'@': '.',
},
},
});
// Optimize chunks for client-side only
if (!isServer) {
config.optimization = {
...config.optimization,
splitChunks: {
chunks: 'all',
minSize: 10000,
maxSize: 244000,
minChunks: 1,
maxAsyncRequests: 30,
maxInitialRequests: 30,
automaticNameDelimiter: '-',
cacheGroups: {
defaultVendors: {
test: /[\\/]node_modules[\\/]/,
priority: -10,
reuseExistingChunk: true,
name: 'vendors',
},
default: {
minChunks: 2,
priority: -20,
reuseExistingChunk: true,
name: 'commons',
},
},
},
};
}
return config;
},
// Add compression
compress: true,
// Disable experimental features that might cause issues
experimental: {
scrollRestoration: true,
},
reactStrictMode: true,
poweredByHeader: false,
// Add chunk optimization
onDemandEntries: {
maxInactiveAge: 25 * 1000,
pagesBufferLength: 2,
},
};
export default config;