-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
59 lines (57 loc) · 1.54 KB
/
next.config.js
File metadata and controls
59 lines (57 loc) · 1.54 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
56
57
58
59
// @ts-check
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
compiler: {
emotion: true,
},
// Performance optimizations
swcMinify: true,
poweredByHeader: false,
compress: true,
productionBrowserSourceMaps: false,
// Reduce build time
eslint: {
// Only run ESLint on build in CI environments
ignoreDuringBuilds: process.env.CI !== "true",
},
typescript: {
// Only run TypeScript type checking on build in CI environments
ignoreBuildErrors: process.env.CI !== "true",
},
// Webpack optimizations
webpack: (config, { dev, isServer }) => {
// Only apply optimizations for client production builds
if (!dev && !isServer) {
// Split chunks more aggressively
config.optimization.splitChunks = {
chunks: "all",
cacheGroups: {
default: false,
vendors: false,
commons: {
name: "commons",
chunks: "all",
minChunks: 2,
},
// Extract React and related libraries into a separate chunk
react: {
name: "react",
chunks: "all",
test: /[\\/]node_modules[\\/](react|react-dom|scheduler)[\\/]/,
priority: 20,
},
// Extract Chakra UI into a separate chunk
chakra: {
name: "chakra",
test: /[\\/]node_modules[\\/]@chakra-ui[\\/]/,
chunks: "all",
priority: 10,
},
},
};
}
return config;
},
};
module.exports = nextConfig;