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 May 8, 2023
1 parent 7e02f11 commit bcc45ec
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/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { genExecArgv, getNodeOptionsWithoutInspect } from '../utils'
import { deserializeErr, errorToJSON } from '../../render'
import crypto from 'crypto'
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 @@ -115,10 +116,13 @@ export const createWorker = (
}
: {}),
},
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 bcc45ec

Please sign in to comment.