-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
65 lines (56 loc) · 1.62 KB
/
next.config.ts
File metadata and controls
65 lines (56 loc) · 1.62 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
import type { NextConfig } from "next";
const bundleAnalyzer = require("@next/bundle-analyzer");
const withBundleAnalyzer = bundleAnalyzer({
enabled: process.env.ANALYZE === "true",
});
const projectRoot = process.cwd();
const nextConfig: NextConfig = {
// Production optimizations
// Note: Next.js 16+ uses SWC minification by default (no config needed)
compiler: {
// Remove console.log in production
removeConsole:
process.env.NODE_ENV === "production"
? { exclude: ["error", "warn"] }
: false,
},
// Optimize images
images: {
formats: ["image/avif", "image/webp"],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [32, 48, 64, 96, 128, 256, 384],
qualities: [75, 90, 95],
remotePatterns: [
{
protocol: "https",
hostname: "i.ytimg.com",
pathname: "/vi/**",
},
{
protocol: "https",
hostname: "placehold.co",
},
],
},
// Enable strict mode for better development experience
reactStrictMode: true,
// Enable React Compiler for automatic memoization (Next.js 16+)
reactCompiler: true,
// Security & performance
poweredByHeader: false,
compress: true,
outputFileTracingRoot: projectRoot,
turbopack: {
root: projectRoot,
},
// Experimental features for better performance
experimental: {
// Enable optimizePackageImports for better tree-shaking
optimizePackageImports: [
"@vercel/analytics",
"@vercel/speed-insights",
"@tanstack/react-virtual", // Optimize virtualization library
],
},
};
export default withBundleAnalyzer(nextConfig);