Skip to content

Commit 7790f72

Browse files
authored
Run export child process with runtime's default max-old-space-size (vercel#78712)
1 parent 4cde29c commit 7790f72

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

packages/next/src/build/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,9 @@ export function createStaticWorker(
764764
progress?.clear()
765765
},
766766
forkOptions: {
767-
env: { ...process.env, NODE_OPTIONS: formatNodeOptions(nodeOptions) },
767+
env: {
768+
NODE_OPTIONS: formatNodeOptions(nodeOptions),
769+
},
768770
},
769771
enableWorkerThreads: config.experimental.workerThreads,
770772
exposedMethods: staticWorkerExposedMethods,

packages/next/src/build/turbopack-build/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ async function turbopackBuildWithWorker() {
1616
maxRetries: 0,
1717
forkOptions: {
1818
env: {
19-
...process.env,
2019
NEXT_PRIVATE_BUILD_WORKER: '1',
2120
NODE_OPTIONS: formatNodeOptions(nodeOptions),
2221
},

packages/next/src/build/webpack-build/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ async function webpackBuildWithWorker(
5757
maxRetries: 0,
5858
forkOptions: {
5959
env: {
60-
...process.env,
6160
NEXT_PRIVATE_BUILD_WORKER: '1',
6261
NODE_OPTIONS: formatNodeOptions(nodeOptions),
6362
},

packages/next/src/lib/worker.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { ChildProcess } from 'child_process'
22
import { Worker as JestWorker } from 'next/dist/compiled/jest-worker'
33
import { Transform } from 'stream'
44

5-
type FarmOptions = ConstructorParameters<typeof JestWorker>[1]
5+
type FarmOptions = NonNullable<ConstructorParameters<typeof JestWorker>[1]>
66

77
const RESTARTED = Symbol('restarted')
88

@@ -19,7 +19,12 @@ export class Worker {
1919

2020
constructor(
2121
workerPath: string,
22-
options: FarmOptions & {
22+
options: Omit<FarmOptions, 'forkOptions'> & {
23+
forkOptions?:
24+
| (Omit<NonNullable<FarmOptions['forkOptions']>, 'env'> & {
25+
env?: Partial<NodeJS.ProcessEnv> | undefined
26+
})
27+
| undefined
2328
timeout?: number
2429
onActivity?: () => void
2530
onActivityAbort?: () => void
@@ -48,8 +53,8 @@ export class Worker {
4853
forkOptions: {
4954
...farmOptions.forkOptions,
5055
env: {
51-
...((farmOptions.forkOptions?.env || {}) as any),
5256
...process.env,
57+
...((farmOptions.forkOptions?.env || {}) as any),
5358
IS_NEXT_WORKER: 'true',
5459
} as any,
5560
},

0 commit comments

Comments
 (0)