Configuring
Next.js 允许你根据特定需求自定义项目。这包括与 TypeScript、ESLint 等的集成,以及诸如绝对导入和环境变量等内部配置选项。
TypeScript
Next.js provides a TypeScript-first development experience for building your React application.
ESLint
Next.js reports ESLint errors and warnings during builds by default. Learn how to opt-out of this behavior here.
Environment Variables
Learn to add and access environment variables in your Next.js application.
Absolute Imports and Module Path Aliases
Configure module path aliases that allow you to remap certain import paths.
src Directory
Save pages under the `src` directory as an alternative to the root `pages` directory.
Markdown and MDX
Learn how to configure MDX to write JSX in your markdown files.
AMP
With minimal config, and without leaving React, you can start adding AMP and improve the performance and speed of your pages.
Babel
Extend the babel preset added by Next.js with your own configs.
PostCSS
Extend the PostCSS config and plugins added by Next.js with your own.
Custom Server
Start a Next.js app programmatically using a custom server.
Draft Mode
Next.js has draft mode to toggle between static and dynamic pages. You can learn how it works with Pages Router.
Error Handling
Handle errors in your Next.js app.
Preview Mode
Next.js has the preview mode for statically generated pages. You can learn how it works here.
Content Security Policy
Learn how to set a Content Security Policy (CSP) for your Next.js application.
Debugging
Learn how to debug your Next.js application with VS Code or Chrome DevTools.