Next.js & App Router (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What is the `next.config.js` file and what are common configurations?
junior LevelCode ExamplenextjsBasic
In Simple Words: The primary configuration file for Next.js:
javascript
/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
remotePatterns: [{ protocol: 'https', hostname: 'images.unsplash.com' }],
},
async redirects() {
return [{ source: '/old-blog/:slug', destination: '/posts/:slug', permanent: true }];
},
async rewrites() {
return [{ source: '/api/v1/:path*', destination: 'https://backend.api.com/:path*' }];
},
experimental: {
ppr: 'incremental',
}
};
module.exports = nextConfig;