From 238e0e28e882278668856e85ef7def59f188ed3b Mon Sep 17 00:00:00 2001 From: Alvalens Date: Tue, 18 Mar 2025 12:36:24 +0700 Subject: [PATCH] chore: performance optimizations --- next.config.js | 32 ++++++++++++++++++++++++++++++++ tailwind.config.js | 6 +++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/next.config.js b/next.config.js index 47f6ef3..cdd1d5e 100644 --- a/next.config.js +++ b/next.config.js @@ -5,6 +5,9 @@ module.exports = withBundleAnalyzer({ // your Next.js configuration images: { domains: ["i.scdn.co"], + // Add image optimization settings + formats: ['image/avif', 'image/webp'], + minimumCacheTTL: 60, }, webpack: (config, options) => { config.module.rules.push({ @@ -23,8 +26,37 @@ module.exports = withBundleAnalyzer({ key: "Content-Type", value: "application/gzip", }, + { + key: "Cache-Control", + value: "public, max-age=3600", // Cache for 1 hour + }, + ], + }, + { + source: '/:path*', + headers: [ + { + key: 'X-Content-Type-Options', + value: 'nosniff', + }, + { + key: 'X-Frame-Options', + value: 'DENY', + }, + { + key: 'X-XSS-Protection', + value: '1; mode=block', + }, ], }, ]; }, + // Add performance optimizations + swcMinify: true, + reactStrictMode: true, + compiler: { + removeConsole: process.env.NODE_ENV === 'production' ? { + exclude: ['error', 'warn'], + } : false, + }, }); diff --git a/tailwind.config.js b/tailwind.config.js index 425c8c8..adff7b9 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -7,8 +7,12 @@ module.exports = { ], theme: { extend: { - // ...existing code... }, }, plugins: [], + // Add this to reduce CSS file size in production + future: { + removeDeprecatedGapUtilities: true, + purgeLayersByDefault: true, + }, };