-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnext.config.ts
More file actions
55 lines (50 loc) · 1.44 KB
/
next.config.ts
File metadata and controls
55 lines (50 loc) · 1.44 KB
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
import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
// Optimize bundle size with granular chunking strategy
webpack: config => {
// Modify chunking strategy to create smaller, more efficient bundles
config.optimization.splitChunks = {
chunks: 'all',
cacheGroups: {
// Bundle core dependencies separately
framework: {
name: 'framework',
test: /[\\/]node_modules[\\/](@react|react|react-dom|next)[\\/]/,
priority: 40,
chunks: 'all',
},
// Bundle Monaco editor separately since it's large
monaco: {
name: 'monaco-editor-chunk',
test: /[\\/]node_modules[\\/]@monaco-editor[\\/]/,
priority: 30,
chunks: 'all',
},
// Bundle highlight.js separately
highlightjs: {
name: 'highlightjs-chunk',
test: /[\\/]node_modules[\\/]highlight\.js[\\/]/,
priority: 20,
chunks: 'all',
},
// Bundle other libs
lib: {
name: 'lib',
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: 'all',
},
},
};
return config;
},
// Optimize images for better loading
images: {
minimumCacheTTL: 60,
},
// Enable compression for faster delivery
compress: true,
// Configure production build optimizations
productionBrowserSourceMaps: false,
};
export default nextConfig;