Build Passed, Browser Still White: When Missing APIs Like findLast and randomUUID Blank the Screen
Frontend teams shipping to older browsers and embedded WebViews pay for missing API coverage at render time, not build time. A hand-rolled polyfill can return a valid-looking `-1` on legal input, and a secure-context API fails on plain HTTP long after CI reports success.
Two production incidents pin down what a green build can miss. In one, a component called `items.findLast(...)` and old browsers threw `TypeError: items.findLast is not a function`; in another, client initialization crashed because `crypto.randomUUID` was not available. Both failures happen during execution, after the build tooling has already succeeded, and both blank the first screen.
Fixing them means sorting failures into three buckets. Syntax the target browser can't parse, like optional chaining, needs transpilation. Missing built-ins, like `findLast`, need a polyfill loaded before first use; `core-js` provides targeted entry points such as `core-js/actual/array/find-last`. A handwritten fallback can look fine on a normal array and still be wrong: on an array-like object with `length` set to `2 ** 32`, the `>>> 0` coercion turns the length to `0` and the loop never runs, so the function returns `-1` where the spec returns `4294967295`. For environment-dependent capabilities, detect at runtime and degrade deliberately. `randomUUID()` only exists in secure contexts, so a fallback can feed `getRandomValues()` bytes into the `uuid` library and return `undefined` when neither source is available.
The decision table maps each failure mode to a treatment and a verification step: transpile and parse the real artifact, polyfill and simulate the method missing before first call, or feature-detect and exercise each fallback path. Load order matters for React, Vue, and Next.js entry points, prototype patches are scoped to an execution context so iframes and Workers need their own, and TypeScript's `lib` does not tell you what a runtime exposes.
Build success and runtime failure live in different layers, so verification needs to happen in the actual target runtime rather than in CI or TypeScript's type checker.
A reverse loop that looks like a correct implementation of `findLastIndex` can produce a legal but wrong return value on a valid array-like object, which makes hand-rolled polyfills riskier than spec-tested libraries.
A missing method is not one problem: `findLast` is a pure JS built-in that a polyfill can replace, while `randomUUID` is gated by secure context and requires a capability-detection fallback, so the same-looking `TypeError` forces different fixes.
Patch loading order also needs to cover first-screen testing.