chore: performance optimizations

This commit is contained in:
Alvalens 2025-03-18 12:36:24 +07:00
parent 21d5b440d4
commit 238e0e28e8
2 changed files with 37 additions and 1 deletions

View file

@ -5,6 +5,9 @@ module.exports = withBundleAnalyzer({
// your Next.js configuration // your Next.js configuration
images: { images: {
domains: ["i.scdn.co"], domains: ["i.scdn.co"],
// Add image optimization settings
formats: ['image/avif', 'image/webp'],
minimumCacheTTL: 60,
}, },
webpack: (config, options) => { webpack: (config, options) => {
config.module.rules.push({ config.module.rules.push({
@ -23,8 +26,37 @@ module.exports = withBundleAnalyzer({
key: "Content-Type", key: "Content-Type",
value: "application/gzip", 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,
},
}); });

View file

@ -7,8 +7,12 @@ module.exports = {
], ],
theme: { theme: {
extend: { extend: {
// ...existing code...
}, },
}, },
plugins: [], plugins: [],
// Add this to reduce CSS file size in production
future: {
removeDeprecatedGapUtilities: true,
purgeLayersByDefault: true,
},
}; };