Skip to main content
Lightning Jar - Web Studio Lightning Jar Wordmark

Findings No. 10

Vercel's production loader rejects require() of an ES module, even on Node 24

Node 22.12+ supports require(esm), so dev and tests pass, but Vercel's lambda instrumentation throws ERR_REQUIRE_ESM and every affected route returns Internal Error.

Replicator Tooling verified Vercel Node 24 runtime (works under plain Node 22.12+ and Bun)

Node 22.12 and later support require() of a synchronous ES module, and your code may depend on that without your knowing: jsdom 29's CommonJS internals require() ES-module files from the @exodus/bytes package. It works under Bun, under plain Node, and in tests. On Vercel's production runtime, the lambda's module instrumentation intercepts Module._load and throws the old ERR_REQUIRE_ESM, even on Node 24.

The failure mode is total for any route whose import graph contains such a require: the route module dies at import time and every request returns a generic Internal Error, while routes without the dependency stay healthy, so the outage looks selective and mysterious. We hit it when an SVG sanitizer built on jsdom 29 entered nine route graphs at once.

The fix is to keep serverless dependency chains CJS-clean (jsdom's last fully-CommonJS chain is the 26 line, enforced by an override) or to load the offending module lazily behind a guarded dynamic import that fails closed. Check Vercel's runtime error logs for ERR_REQUIRE_ESM before suspecting your own code.

Receipt: Replicator production outage and fix, 2026-10-21 (v3.262.0 broke it, v3.268.0 pinned html-encoding-sniffer, v3.268.1 added the global jsdom 26 override).

Ask Eljay

Ask about the studio's work, research, packages, or writing. A few starters:

Answers come from this site's own content and link their sources. For anything that matters, email hello@lightningjar.com.