Allow opt-in facade-backed export mangling (#99309)
## Summary The rollback in #99285 keeps local-only modules unsplit by default to avoid the remote-components singleton regression in #99279. This follow-up preserves facade-backed export mangling as an **opt-in** for applications that benefit from shorter keys even when a namespace escapes. `experimental.turbopackMangleViaMaterializedNamespaceObject` controls the split independently from `turbopackMangleExportNames`. If unset, it is enabled only when `turbopackMangleExportNames` is explicitly `true`; canary's implicit production mangling does **not** enable it. An explicit `false` wins. The option reaches both server and client Turbopack contexts; re-export splitting and ordinary export mangling are unchanged. The config and splitting comments document the compatibility risk for code that patches modules split into multiple parts. ## Verification - Turbopack execution: 313 passed with the facade option enabled by default in the **test harness**, including the original mixed-import regression explicitly opted out and a no-export-mangling control. Escaping-namespace fixtures also verify facade-backed mangling retains original public names. Snapshots: 132 passed. The production defaults are unchanged. - Turbopack ECMAScript unit tests: 590 passed; Next core unit tests: 82 passed after removing the config-default helper test requested in review. - `pnpm build-all` (18/18 tasks), `pnpm --filter next types`, formatting and lint-staged checks passed. - Production Turbopack emit-collect fixture: 9 tests and 18 snapshots passed with defaults. - A scratch production Next.js app confirmed the module has facade and `<locals>` IDs with explicit export mangling and the new option inferred on, but no `<locals>` ID when the new option is explicitly off or both options are omitted. The scratch app is not included. <!-- NEXT_JS_LLM --> <!-- fleet faf1202d-c919-4f7d-bb74-d3fe954bbc57 --> --------- 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> Co-authored-by:
Luke Sandberg <210140+lukesandberg@users.noreply.github.com>
Showing
Please
register
or
sign in
to comment