vkorobtsev-nextJs/next.config.js
Alvalen Shafel 7f0c142dda
Refactor and update project components for Next.js 15 compatibility (#6)
* refactor: update all modules to latest version

* refactor: update layout to match nextjs 15 convention

* fix: implement TopProgressBar as Client

* fix: remove unnecessary locale prop

* fix: update postcss.config.js export

* fix: comment out styles

* fix: ref usage in useIntersectionObserver and update Navbar

* chore: performance optimizations

* fix: simplify Loading component structure

* refactor: move ProjectCard component and add prop types validation
2025-03-18 12:39:32 +07:00

62 lines
1.2 KiB
JavaScript

const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
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({
test: /\.pdf$/i,
type: "asset/source",
});
return config;
},
async headers() {
return [
{
source: "/sitemap.xml.gz",
headers: [
{
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,
},
});