SIGN IN SIGN UP

fix(core): build the force-account-model exempt scope lazily

The dashboard has not mounted since v3.5.62. In the browser console:

    Uncaught TypeError: Yb is not a constructor
        at force-account-model.ts:41

core/src/index.ts re-exports force-account-model, the dashboard imports
that barrel in 14 places, so the module ships inside the browser bundle.
A browser bundle has no node:async_hooks — Bun's browser target rewrites
the import into a destructure from an empty stub:

    var{AsyncLocalStorage:Yb}=(()=>({}));var XG6=new Yb;

so the module-scope construction added in 693ea10d throws while the chunk
is still initialising, and that chunk carries the React bootstrap. The
server is unaffected: the proxy keeps serving requests normally, which is
why this slipped through.

Build the scope on first use instead. Nothing in the browser calls these
functions, so the browser never constructs anything, while on the server
the first caller builds the one scope and every later caller reuses it —
same behaviour as before.

The regression test bundles the module with Bun's browser target and
evaluates it, which is the only faithful reproduction: mock.module cannot
stand in, because a named ESM import of a missing export fails to link
rather than yielding undefined.
A
aaapl committed
83e43fe6e56ae77f7aa0db68b78a0c0b2c07b101
Parent: 34881cf