Skip to content

Commit 56f2f12

Browse files
committed
Allow opt-out
1 parent 3a03826 commit 56f2f12

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"lint-staged": "lint-staged",
5353
"next-with-deps": "./scripts/next-with-deps.sh",
5454
"next": "cross-env NEXT_TELEMETRY_DISABLED=1 node --trace-deprecation --enable-source-maps packages/next/dist/bin/next",
55-
"next-no-sourcemaps": "cross-env NEXT_TELEMETRY_DISABLED=1 node --trace-deprecation packages/next/dist/bin/next",
55+
"next-no-sourcemaps": "echo 'No longer supported. Use `pnpm next --disable-source-maps` instead'; exit 1;",
5656
"clean-trace-jaeger": "node scripts/rm.mjs test/integration/basic/.next && TRACE_TARGET=JAEGER pnpm next build test/integration/basic",
5757
"debug": "cross-env NEXT_TELEMETRY_DISABLED=1 node --inspect --trace-deprecation --enable-source-maps packages/next/dist/bin/next",
5858
"postinstall": "node scripts/git-configure.mjs && node scripts/install-native.mjs",

packages/next/src/bin/next.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ program
172172
'-H, --hostname <hostname>',
173173
'Specify a hostname on which to start the application (default: 0.0.0.0).'
174174
)
175+
.option(
176+
'--disable-source-maps',
177+
"Don't start the Dev server with `--enable-source-maps`.",
178+
false
179+
)
175180
.option(
176181
'--experimental-https',
177182
'Starts the server with HTTPS and generates a self-signed certificate.'

packages/next/src/cli/next-dev.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { clearTimeout } from 'timers'
3939
import { flushAllTraces, trace } from '../trace'
4040

4141
export type NextDevOptions = {
42+
disableSourceMaps: boolean
4243
turbo?: boolean
4344
turbopack?: boolean
4445
port: number
@@ -265,7 +266,9 @@ const nextDev = async (
265266
delete nodeOptions['max_old_space_size']
266267
}
267268

268-
nodeOptions['enable-source-maps'] = true
269+
if (!options.disableSourceMaps) {
270+
nodeOptions['enable-source-maps'] = true
271+
}
269272

270273
if (nodeDebugType) {
271274
const address = getParsedDebugAddress()

0 commit comments

Comments
 (0)