fix: keep the Docker build within Node's default heap #1510

This commit is contained in:
Linus Rath
2026-11-03 15:40:09 +01:00
parent 03e7cd86f1
commit fbda1e3401
2 changed files with 18 additions and 0 deletions
@@ -0,0 +1,11 @@
import { describe, expect, it } from 'vitest';
import config from '../../next.config';
describe('webpack build worker', () => {
// Next turns the workers off for a config with a webpack hook unless the
// option is set, and the Docker build then runs out of heap (#1510).
it('stays on although next-intl adds a webpack hook', () => {
expect(config.webpack).toBeTypeOf('function');
expect(config.experimental?.webpackBuildWorker).toBe(true);
});
});
+7
View File
@@ -102,6 +102,13 @@ const nextConfig: NextConfig = {
typescript: {
tsconfigPath: "tsconfig.build.json",
},
// next-intl's plugin adds a webpack hook, and with one Next runs the client,
// server and edge compilers in its main process on one heap, which outgrew
// Node's default limit of about 2.2 GB (#1510). In workers each compiler has
// its own heap, freed when it finishes. Turbopack builds don't read this.
experimental: {
webpackBuildWorker: true,
},
// No proxyClientMaxBodySize: Next copies every body proxy.ts runs for up to
// that size before routing, so it stays at the 10 MB default. The routes
// that take bigger uploads (WOPI saves, WebDAV, /api/plugin-proxy) are left