-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.js
More file actions
100 lines (97 loc) · 2.49 KB
/
Copy pathnext.config.js
File metadata and controls
100 lines (97 loc) · 2.49 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
const { PHASE_PRODUCTION_BUILD } = require('next/constants');
/** @type {import('next').NextConfig} */
const baseConfig = {
reactStrictMode: true,
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'images.credly.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'i.pinimg.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'img-cdn.thepublive.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'upload.wikimedia.org',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'www.festivalsfromindia.com',
port: '',
pathname: '/**',
},
],
formats: ['image/avif', 'image/webp'],
minimumCacheTTL: 60,
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
},
compiler: {
removeConsole: process.env.NODE_ENV === 'production',
},
experimental: {
optimizeCss: process.env.NODE_ENV === 'production',
optimizePackageImports: ['framer-motion', 'lucide-react'],
},
serverExternalPackages: ['sharp'],
// Enable compression
compress: true,
// Disable powered by header
poweredByHeader: false,
// Disable production source maps
productionBrowserSourceMaps: false,
};
module.exports = (phase) => {
// In dev (Turbopack) do NOT expose a webpack config to avoid warnings
if (phase !== PHASE_PRODUCTION_BUILD) {
return baseConfig;
}
// Only include webpack customizations during production builds
return {
...baseConfig,
webpack: (config, { isServer }) => {
if (!isServer) {
config.optimization = {
...config.optimization,
splitChunks: {
chunks: 'all',
minSize: 20000,
maxSize: 244000,
minChunks: 1,
maxAsyncRequests: 30,
maxInitialRequests: 30,
cacheGroups: {
defaultVendors: {
test: /[\\/]node_modules[\\/]/,
priority: -10,
reuseExistingChunk: true,
},
default: {
minChunks: 2,
priority: -20,
reuseExistingChunk: true,
},
},
},
runtimeChunk: 'single',
minimize: true,
};
}
return config;
},
};
};