Enable Turbopack export name mangling by default for builds (#99362)
### What? `experimental.turbopackMangleExportNames` is now on by default for production builds (`next build`) in both stable and canary releases. It stays off by default in development (`next dev`), and an explicit `true`/`false` in `next.config` still wins in either mode. ### Why? Mangling export names shortens the keys modules use to link to each other, which reduces bundle size. Until now it was only on by default in canary builds, because stable releases pinned it to `false`. ### How? Turbopack already chooses the default from the build mode in `NextConfig::turbopack_mangle_export_names`: if the option is unset, it's enabled everywhere except development, and an explicit value overrides that. The only thing keeping it off on stable was the JS default config, which forced `false` when `isStableBuild()` was true. That pin is removed, so the default stays unset on every release channel and the Rust side decides from the build mode. There's no change to Rust or to the mangling itself. The JSDoc on the config type and the Turbopack config docs table now say the default is `false` in dev and `true` for builds. ### Verification - Prettier and ESLint pass on the changed files. - `pnpm --filter=next types`: only 3 `TS2307` errors, all for missing generated `dist` modules (`@next/font`, `@vercel/og`) in an unbootstrapped checkout. The same errors show up without this change, and none are in `config-shared.ts`. - Not run: a bootstrapped integration build. CI covers the build-mode behavior end to end. <!-- NEXT_JS_LLM --> <!-- fleet dfbd6860-64e0-4a98-ac6f-220e8131fee2 --> --------- Co-authored-by:vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
Showing
Please
register
or
sign in
to comment