Skip to content

Conversation

pull[bot]
Copy link

@pull pull bot commented May 9, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

vercel-release-bot and others added 4 commits May 9, 2025 10:33
When mangling is disabled with `next build --no-mangling`, the function
names of `"use cache"` functions are currently still mangled.

The reason is that those functions are transformed to inline function
expressions whose names are removed by the SWC minifier even if `mangle`
is `false`.

Original:

```js
'use cache'

export async function getCachedData() {
  return functionThatMightThrow()
}
```

Transformed by the Next.js compiler during `next dev`:

```js
export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "<id>", 0, async function getCachedData() {
  return functionThatMightThrow()
});
```

Transformed by the Next.js compiler during `next build`:

```js
export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "<id>", 0, async function () {
  return functionThatMightThrow()
});
```

By setting `keep_fnames` to `true` in SWC's `compress` options, we can
ensure that those function expression names are preserved when building
with `--no-mangling`, which is helpful when looking at error stacks or
traces.
@pull pull bot added the ⤵️ pull label May 9, 2025
@pull pull bot merged commit c4c3aee into code:canary May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants