Skip to content

Commit

Permalink
fix: Add NODE_OPTIONS for debugging in next-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Cow258 committed Apr 12, 2023
1 parent c11bce5 commit 6c93e4f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 8 additions & 4 deletions packages/next/src/server/lib/server-ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { genExecArgv, getNodeOptionsWithoutInspect } from './utils'
import { deserializeErr, errorToJSON } from '../render'
import { IncomingMessage } from 'http'
import isError from '../../lib/is-error'
import { genRenderExecArgv } from './worker-utils'

// we can't use process.send as jest-worker relies on
// it already and can cause unexpected message errors
Expand Down Expand Up @@ -90,10 +91,13 @@ export const createWorker = (
NODE_ENV: process.env.NODE_ENV,
NEXT_PREBUNDLED_REACT: process.env.NEXT_PREBUNDLED_REACT,
},
execArgv: genExecArgv(
isNodeDebugging === undefined ? false : isNodeDebugging,
(serverPort || 0) + 1
),
execArgv:
isNodeDebugging !== undefined
? genExecArgv(
isNodeDebugging === undefined ? false : isNodeDebugging,
(serverPort || 0) + 1
)
: genRenderExecArgv(),
},
exposedMethods: [
'initialize',
Expand Down
8 changes: 4 additions & 4 deletions packages/next/src/server/lib/start-server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import http from 'http'
import { isIPv6 } from 'net'
import * as Log from '../../build/output/log'
import { getNodeOptionsWithoutInspect } from './utils'
import type { IncomingMessage, ServerResponse } from 'http'
import type { ChildProcess } from 'child_process'
import { normalizeRepeatedSlashes } from '../../shared/lib/utils'
Expand Down Expand Up @@ -189,9 +188,10 @@ export async function startServer({
...((initialEnv || process.env) as typeof process.env),
// we don't pass down NODE_OPTIONS as it can
// extra memory usage
NODE_OPTIONS: getNodeOptionsWithoutInspect()
.replace(/--max-old-space-size=[\d]{1,}/, '')
.trim(),
// We should allow this to be passed down for render-server
// NODE_OPTIONS: getNodeOptionsWithoutInspect()
// .replace(/--max-old-space-size=[\d]{1,}/, '')
// .trim(),
},
},
exposedMethods: ['initialize'],
Expand Down

0 comments on commit 6c93e4f

Please sign in to comment.