diff --git a/packages/next/build/index.ts b/packages/next/build/index.ts index d9c6a555025d6..f73d2e24af505 100644 --- a/packages/next/build/index.ts +++ b/packages/next/build/index.ts @@ -543,33 +543,25 @@ export default async function build( const webpackBuildStart = process.hrtime() let result: CompilerResult = { warnings: [], errors: [] } - // We run client and server compilation separately when configured for - // memory constraint and for serverless to be able to load manifests - // produced in the client build - if (isLikeServerless || config.experimental.serialWebpackBuild) { - await nextBuildSpan - .traceChild('run-webpack-compiler') - .traceAsyncFn(async () => { - const clientResult = await runCompiler(clientConfig) - // Fail build if clientResult contains errors - if (clientResult.errors.length > 0) { - result = { - warnings: [...clientResult.warnings], - errors: [...clientResult.errors], - } - } else { - const serverResult = await runCompiler(configs[1]) - result = { - warnings: [...clientResult.warnings, ...serverResult.warnings], - errors: [...clientResult.errors, ...serverResult.errors], - } + // We run client and server compilation separately to optimize for memory usage + await nextBuildSpan + .traceChild('run-webpack-compiler') + .traceAsyncFn(async () => { + const clientResult = await runCompiler(clientConfig) + // Fail build if clientResult contains errors + if (clientResult.errors.length > 0) { + result = { + warnings: [...clientResult.warnings], + errors: [...clientResult.errors], } - }) - } else { - result = await nextBuildSpan - .traceChild('run-webpack-compiler') - .traceAsyncFn(() => runCompiler(configs)) - } + } else { + const serverResult = await runCompiler(configs[1]) + result = { + warnings: [...clientResult.warnings, ...serverResult.warnings], + errors: [...clientResult.errors, ...serverResult.errors], + } + } + }) const webpackBuildEnd = process.hrtime(webpackBuildStart) if (buildSpinner) { diff --git a/packages/next/next-server/server/config-shared.ts b/packages/next/next-server/server/config-shared.ts index 7234dfeda8af2..56dd067f77d45 100644 --- a/packages/next/next-server/server/config-shared.ts +++ b/packages/next/next-server/server/config-shared.ts @@ -50,7 +50,6 @@ export type NextConfig = { [key: string]: any } & { scriptLoader?: boolean stats?: boolean externalDir?: boolean - serialWebpackBuild?: boolean conformance?: boolean amp?: { optimizer?: any @@ -115,7 +114,6 @@ export const defaultConfig: NextConfig = { scriptLoader: false, stats: false, externalDir: false, - serialWebpackBuild: false, turboMode: false, eslint: false, reactRoot: Number(process.env.NEXT_PRIVATE_REACT_ROOT) > 0,