Skip to content

Commit 98b0700

Browse files
ijjkunstubbable
andauthored
Ensure mangling is disabled for dev runtime builds (#75297)
Just ensures we keep mangling behavior prior to #75294 --------- Co-authored-by: Hendrik Liebau <[email protected]>
1 parent c140b80 commit 98b0700

File tree

5 files changed

+11
-225
lines changed

5 files changed

+11
-225
lines changed

contributing/core/vscode-debugger.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ To see the changes you make to the Next.js codebase during development, you can
2424

2525
When developing/debugging Next.js, you can set breakpoints anywhere in the `packages/next` source code that will stop the debugger at certain locations so you can examine the behavior. Read more about [breakpoints in the VS Code documentation](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_breakpoints).
2626

27-
To ensure that the original names are displayed in the "Variables" section, build the Next.js source code with `NEXT_SERVER_EVAL_SOURCE_MAPS=1`. This is automatically applied when using `pnpm dev`.
27+
To ensure that the original names are displayed in the "Variables" section, build the Next.js source code with `NEXT_SERVER_NO_MANGLE=1`. This is automatically applied when using `pnpm dev`.

packages/next/next_runtime.config.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const webpack = require('@rspack/core')
1+
const rspack = require('@rspack/core')
22
const path = require('path')
33
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
44
const DevToolsIgnoreListPlugin = require('./webpack-plugins/devtools-ignore-list-plugin')
@@ -172,11 +172,17 @@ module.exports = ({ dev, turbo, bundleType, experimental }) => {
172172
moduleIds: 'named',
173173
minimize: true,
174174
concatenateModules: true,
175-
minimizer: [new webpack.SwcJsMinimizerRspackPlugin()],
175+
minimizer: [
176+
new rspack.SwcJsMinimizerRspackPlugin({
177+
minimizerOptions: {
178+
mangle: dev || process.env.NEXT_SERVER_NO_MANGLE ? false : true,
179+
},
180+
}),
181+
],
176182
},
177183
plugins: [
178184
new DevToolsIgnoreListPlugin({ shouldIgnorePath }),
179-
new webpack.DefinePlugin({
185+
new rspack.DefinePlugin({
180186
'typeof window': JSON.stringify('undefined'),
181187
'process.env.NEXT_MINIMAL': JSON.stringify('true'),
182188
'this.serverOptions.experimentalTestProxy': JSON.stringify(false),

packages/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"next": "./dist/bin/next"
8181
},
8282
"scripts": {
83-
"dev": "taskr",
83+
"dev": "cross-env NEXT_SERVER_NO_MANGLE=1 taskr",
8484
"release": "taskr release",
8585
"build": "pnpm release",
8686
"prepublishOnly": "cd ../../ && turbo run build",

packages/next/src/build/webpack/plugins/eval-source-map-dev-tool-plugin.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Author Tobias Koppers @sokra
44
55
Forked to add support for `ignoreList`.
6-
Keep in sync with packages/next/webpack-plugins/eval-source-map-dev-tool-plugin.js
76
*/
87
import {
98
type webpack,

packages/next/webpack-plugins/eval-source-map-dev-tool-plugin.js

Lines changed: 0 additions & 219 deletions
This file was deleted.

0 commit comments

Comments
 (0)