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 14, 2023
1 parent afddb6e commit 800348a
Show file tree
Hide file tree
Showing 2 changed files with 11 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
5 changes: 3 additions & 2 deletions packages/next/src/server/lib/start-server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
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'
import { initialEnv } from '@next/env'
import { getNodeOptionsWithoutInspect } from './utils'

export interface StartServerOptions {
dir: string
Expand Down Expand Up @@ -187,7 +187,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
// NODE_OPTIONS: getNodeOptionsWithoutInspect().trim(),
},
},
exposedMethods: ['initialize'],
Expand Down

0 comments on commit 800348a

Please sign in to comment.