主题
isolatedDevBuild
实验性的 isolatedDevBuild 选项将开发和生产构建的输出分别放在不同的目录中。启用后,开发服务器 (next dev) 会将其输出写入 .next/dev 而不是 .next,从而避免在同时运行 next dev 和 next build 时发生冲突。
¥The experimental isolatedDevBuild option separates development and production build outputs into different directories. When enabled, the development server (next dev) writes its output to .next/dev instead of .next, preventing conflicts when running next dev and next build concurrently.
当自动化工具(例如 AI 代理)在开发服务器运行时运行 next build 来验证更改时,这一点尤其有用,可以确保开发服务器不受构建过程中所做的更改的影响。
¥This is especially helpful when automated tools (for example, AI agents) run next build to validate changes while your development server is running, ensuring the dev server is not affected by changes made by the build process.
此功能默认启用,以保持开发和生产输出的分离,并防止冲突。
¥This feature is enabled by default to keep development and production outputs separate and prevent conflicts.
配置
¥Configuration
要选择退出此功能,请在配置中将 isolatedDevBuild 设置为 false:
¥To opt out of this feature, set isolatedDevBuild to false in your configuration:
ts
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
experimental: {
isolatedDevBuild: false, // defaults to true
},
}
export default nextConfig版本历史
¥Version History
| 版本 | 更改 |
|---|---|
v16.0.0 | experimental.isolatedDevBuild 已推出。 |