diff --git a/package.json b/package.json index e0ca46e28fafe..d4599a71909bd 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "prepublishOnly": "turbo run build", "lint-staged": "lint-staged", "next-with-deps": "./scripts/next-with-deps.sh", - "next": "cross-env NEXT_TELEMETRY_DISABLED=1 node --trace-deprecation --enable-source-maps packages/next/dist/bin/next", + "next": "cross-env NEXT_TELEMETRY_DISABLED=1 NODE_OPTIONS=\"--trace-deprecation --enable-source-maps\" next", "next-no-sourcemaps": "echo 'No longer supported. Use `pnpm next --disable-source-maps` instead'; exit 1;", "clean-trace-jaeger": "node scripts/rm.mjs test/integration/basic/.next && TRACE_TARGET=JAEGER pnpm next build test/integration/basic", "debug": "cross-env NEXT_TELEMETRY_DISABLED=1 node --inspect --trace-deprecation --enable-source-maps packages/next/dist/bin/next", diff --git a/packages/next/src/cli/next-dev.ts b/packages/next/src/cli/next-dev.ts index 60d681bc89cd3..90154b3e03483 100644 --- a/packages/next/src/cli/next-dev.ts +++ b/packages/next/src/cli/next-dev.ts @@ -266,7 +266,9 @@ const nextDev = async ( delete nodeOptions['max_old_space_size'] } - if (!options.disableSourceMaps) { + if (options.disableSourceMaps) { + delete nodeOptions['enable-source-maps'] + } else { nodeOptions['enable-source-maps'] = true }