Skip to content

Commit

Permalink
Ensure mangling is disabled for dev runtime builds (#75297)
Browse files Browse the repository at this point in the history
Just ensures we keep mangling behavior prior to
#75294

---------

Co-authored-by: Hendrik Liebau <[email protected]>
  • Loading branch information
ijjk and unstubbable authored Jan 25, 2025
1 parent c140b80 commit 98b0700
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 225 deletions.
2 changes: 1 addition & 1 deletion contributing/core/vscode-debugger.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ To see the changes you make to the Next.js codebase during development, you can

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).

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`.
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`.
12 changes: 9 additions & 3 deletions packages/next/next_runtime.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const webpack = require('@rspack/core')
const rspack = require('@rspack/core')
const path = require('path')
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
const DevToolsIgnoreListPlugin = require('./webpack-plugins/devtools-ignore-list-plugin')
Expand Down Expand Up @@ -172,11 +172,17 @@ module.exports = ({ dev, turbo, bundleType, experimental }) => {
moduleIds: 'named',
minimize: true,
concatenateModules: true,
minimizer: [new webpack.SwcJsMinimizerRspackPlugin()],
minimizer: [
new rspack.SwcJsMinimizerRspackPlugin({
minimizerOptions: {
mangle: dev || process.env.NEXT_SERVER_NO_MANGLE ? false : true,
},
}),
],
},
plugins: [
new DevToolsIgnoreListPlugin({ shouldIgnorePath }),
new webpack.DefinePlugin({
new rspack.DefinePlugin({
'typeof window': JSON.stringify('undefined'),
'process.env.NEXT_MINIMAL': JSON.stringify('true'),
'this.serverOptions.experimentalTestProxy': JSON.stringify(false),
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"next": "./dist/bin/next"
},
"scripts": {
"dev": "taskr",
"dev": "cross-env NEXT_SERVER_NO_MANGLE=1 taskr",
"release": "taskr release",
"build": "pnpm release",
"prepublishOnly": "cd ../../ && turbo run build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Author Tobias Koppers @sokra
Forked to add support for `ignoreList`.
Keep in sync with packages/next/webpack-plugins/eval-source-map-dev-tool-plugin.js
*/
import {
type webpack,
Expand Down
219 changes: 0 additions & 219 deletions packages/next/webpack-plugins/eval-source-map-dev-tool-plugin.js

This file was deleted.

0 comments on commit 98b0700

Please sign in to comment.