Summary
The namespace object for a dynamically-imported pure re-export chunk is empty. This is the canonical shape esbuild/bun emit for a shared chunk under --splitting, so it breaks code-split bundles.
Repro
esbuild src/index.ts --bundle --splitting --format=esm --outdir=out --platform=node
perry out/index.js -o app && ./app
esbuild emits out/agent-VP4LHHJR.js as a 2-statement re-export file:
import { run } from "./chunk-XXXX.js";
export { run };
Result:
|
node |
perry main |
typeof ns |
object |
object |
typeof ns.run |
function |
undefined |
ns.run() |
"[shared-util] agent" |
(missing) |
| a chunk containing real code (not a re-export) |
works |
works |
Perry ingests the whole graph correctly (Found 4 module(s): 4 native, 0 JavaScript) — the chunk-set ingestion from #5572 works. It is specifically the re-export-only chunk whose namespace comes out empty.
Worse: an unguarded ns.run() printed undefined rather than throwing ns.run is not a function, so this is a silent wrong answer.
Likely the same family as #5916 (barrel re-export of a namespace value never gets a wrapper).
Split out of #5207, whose headline ask (ingest a bundler's chunk-set) did ship.
Summary
The namespace object for a dynamically-imported pure re-export chunk is empty. This is the canonical shape esbuild/bun emit for a shared chunk under
--splitting, so it breaks code-split bundles.Repro
esbuild emits
out/agent-VP4LHHJR.jsas a 2-statement re-export file:Result:
maintypeof nsobjectobjecttypeof ns.runfunctionundefinedns.run()"[shared-util] agent"Perry ingests the whole graph correctly (
Found 4 module(s): 4 native, 0 JavaScript) — the chunk-set ingestion from #5572 works. It is specifically the re-export-only chunk whose namespace comes out empty.Worse: an unguarded
ns.run()printedundefinedrather than throwingns.run is not a function, so this is a silent wrong answer.Likely the same family as #5916 (barrel re-export of a namespace value never gets a wrapper).
Split out of #5207, whose headline ask (ingest a bundler's chunk-set) did ship.