Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure mangling is disabled for dev runtime builds #75297

Merged
merged 4 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading