Files
hyperframes/packages
ukimsanov 41916db9e3 fix(producer): shim CJS __dirname/__filename in ESM banner
The producer bundle is emitted as ESM. The existing banner already shimmed
`require` via createRequire so CJS dep `require("fs")` calls work, but it
did NOT shim the CommonJS `__dirname` / `__filename` globals.

A bundled CJS dep (the ffmpeg/Emscripten wasm glue) references bare
`__dirname` to locate the wasm side-file — e.g. `scriptDirectory = __dirname
+ "/"` — and crashed at render time with:

    ReferenceError: __dirname is not defined in ES module scope

This affects every render through producer (not just w2h), and only
manifests on first render of a fresh checkout where the producer hasn't
been rebuilt with the shim.

The fix reconstructs both globals from import.meta.url inside the esbuild
banner, alongside the existing `require` shim. No behavior change for code
that doesn't reference __dirname; correctly resolves the CJS contract for
code that does.

Verified by re-running a producer render after rebuild — completes through
ffmpeg without the ReferenceError.
2026-06-11 19:46:04 -07:00
..
2026-06-11 02:40:36 +00:00
2026-06-11 02:40:36 +00:00
2026-06-11 02:40:36 +00:00
2026-06-11 02:40:36 +00:00
2026-06-11 02:40:36 +00:00
2026-06-11 02:40:36 +00:00
2026-06-11 02:40:36 +00:00