next.config and Build Configuration — Concept Check
Questions on next.config and Build Configuration. One file controls redirects, headers, image hosts, rewrites and the experimental flags. Most of what belongs here is infrastructure, and most of what does not is business logic.
Questions in this quiz
7 questions on next.config and Build Configuration — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A Next.js application is experiencing unexpected behavior in production after copying an experimental flag from a blog. What is the most likely cause?
- AThe experimental flag altered caching or rendering behavior.
- BThe application was not rebuilt after adding the flag.
- CThe flag was not properly documented in the code.
- DThe flag was meant for development only.
2.You notice that your Next.js application is serving outdated content. Which configuration might be responsible for this?
- AIncorrect redirects configuration.
- BImproperly set remotePatterns for images.
- CMisconfigured staleTimes experimental flag.
- DMissing security headers.
3.A developer sets `trailingSlash: true` in the Next.js config after deployment. What is the immediate consequence?
- AImage hosts will need reconfiguration.
- BAll URLs will have a trailing slash, requiring redirects.
- CThe application will not build successfully.
- DSecurity headers will be ignored.
4.In a Next.js application, which configuration should not be used to hide build-time failures?
- AbasePath: '/app'
- Beslint: { ignoreDuringBuilds: true }
- Ctypescript: { ignoreBuildErrors: true }
- Dexperimental: { optimizePackageImports: ['library'] }
5.A Next.js application needs to proxy an API while keeping cookies first-party. Which configuration should be used?
- AAdd experimental flags to handle the API.
- BUse redirects to change the API URL.
- CUse rewrites to proxy the API.
- DSet up a new image host for the API.
6.What is the risk of using `removeConsole` in the Next.js config for production?
- AIt can remove all console logs, including errors.
- BIt impacts the performance of image loading.
- CIt causes the application to ignore build errors.
- DIt only removes console logs during development.
7.A Next.js application is deployed in a preview environment. What configuration ensures it doesn't compete with production in search engine results?
- ADisable `reactStrictMode`.
- BEnable `productionBrowserSourceMaps`.
- CUse `headers` to add `X-Robots-Tag: noindex`.
- DSet `basePath` to a unique value.