Commit 12ac7ad
fix(cloud/frontend): repair /login render — broken inherits prebundle crashes React tree
The Cloud Tests > playwright job's 4 chronic failures (and the entire
broken /login render in dev) trace to a single Vite/rolldown
optimizeDeps issue with the `inherits` polyfill.
Repro (verified locally with Chrome devtools):
- /login mounted briefly, then crashed with
TypeError: require_inherits_browser is not a function
at .../elliptic-XXX.js
- Result: blank black page, "Welcome back" heading and
`you@example.com` placeholder never rendered.
Root cause:
1. `inherits/inherits.js` (the npm main entry) does
try { module.exports = require('util').inherits }
catch { module.exports = require('./inherits_browser.js') }
Vite's `util` alias is an empty shim, so the catch path runs —
but rolldown's CommonJS prebundle for the elliptic graph hoists
the consumer call sites *before* `require_inherits_browser`'s
wrapper definition, throwing on first crypto access.
2. The same prebundle hoists `require_inherits` reference for
nested elliptic submodules before its wrapper is wired up.
Fix:
- Resolve `inherits` directly to a self-contained `inherits.cjs`
browser shim — bypasses the try/catch entirely so the catch
path's require chain never enters the prebundle.
- Add the entire crypto graph (elliptic + inherits + hash-base +
create-hash + create-hmac + browserify-sign + secp256k1) to
`optimizeDeps.include` so rolldown bundles them as a single
deterministic chunk with wrappers at top-level.
Verified: /login now renders the full Steward login section
(Welcome back heading, email input, Passkey/Magic Link/Ethereum/
Solana buttons) with zero console errors.
This unblocks the 4 chronic Cloud Tests > playwright failures:
- auth-routing > login renders without page errors when returnTo
is provided
- public-pages > /login renders the Steward login page
- public-pages > /login Terms link reaches React Router terms
- steward-wallet-auth > Ethereum wallet sign-in signs through
Steward and redirects to dashboard
…and by extension NPM Release, which has been gated on Cloud
Tests success.
Replaces a dropped TypeScript shim with a CommonJS one because the
file is consumed via `require()` from optimized-deps wrappers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a59f026 commit 12ac7ad
3 files changed
Lines changed: 66 additions & 49 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
112 | 128 | | |
113 | 129 | | |
114 | 130 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
126 | 143 | | |
127 | 144 | | |
128 | 145 | | |
| |||
0 commit comments