AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Turbopack Drops Parentheses Around Pure-Annotated IIFE Callee, Causing Minifier To Remove Side-Effectful Outer Call

In production Turbopack builds, an IIFE whose inner callee has a /* @__PURE__ */ annotation is incorrectly stripped when the parentheses around the inner call are removed during transformation. The annotation then applies to the outer call, which the minifier treats as pure and deletes, breaking runtime behavior.

highConfidence 90%Next.jsHydrationServer ActionsAffected V16.3.5Affected V16.4.0Affected V16.5.0-Canary.4

Origin Analysis

The Turbopack transform pipeline drops parentheses around a CallExpression that is used as the callee of another CallExpression when the inner call has a /* @__PURE__ */ comment. This changes the annotation's scope from the inner call to the outer call, causing SWC minifier (or other minifier) to consider the outer call side-effect-free and remove it.
1. Clone https://github.com/oenstrom/next-turbopack-pure-iife and run npm install. 2. Run npm run dev; observe both 'annotated IIFE: ran' and 'plain IIFE: ran'. 3. Run npm run build && npm run start with Turbopack; observe 'annotated IIFE: REMOVED'. 4. Run npx next build --webpack && npm run start; observe both lines show 'ran'.

Fixing Code Block

Edge Case Audit

This workaround removes PURE annotations across all Radix UI packages, which may reduce tree-shaking efficiency and slightly increase bundle size. It could also affect any other library that relies on similar patterns if included in the scan (only @radix-ui is targeted). Revert by deleting the patched files and reinstalling node_modules when the official Next.js/Turbopack fix is available. Ensure the postinstall script runs in CI and local environments; otherwise run it manually.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state