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 16, 2023
1 parent e5ad96e commit 4ec16e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 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
4 changes: 2 additions & 2 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 @@ -187,7 +186,8 @@ export async function startServer({
env: {
FORCE_COLOR: '1',
...((initialEnv || process.env) as typeof process.env),
NODE_OPTIONS: getNodeOptionsWithoutInspect().trim(),
// We should allow NodeOptions to be passed down for render-server for debugging
NODE_OPTIONS: process.env.NODE_OPTIONS,
},
},
exposedMethods: ['initialize'],
Expand Down

0 comments on commit 4ec16e9

Please sign in to comment.