Commit 249b2f6
committed
fix(web): name the four Node builtins the browser bundle now destructures
The Docker leg failed on `vite build`, and this one is genuinely this
branch's. @nodetool-ai/runtime now depends on @nodetool-ai/storage, which
drags @openclaw/fs-safe into the browser graph; it destructures readSync and
closeSync from node:fs, and the stub that replaces node:fs in the web bundle
did not export them. Two more surfaced behind the first: createHmac from
node:crypto, and request plus createRequire from the shared empty stub that
covers node:http, node:https and node:module.
A named import binds at bundle time, so empty.js's default Proxy cannot
satisfy one — every name a workspace bundle destructures needs a real export.
Each addition keeps the file's existing shape: throw on use, because
browser-tagged code must never reach these.
Also adds mkdtemp to the fs-promises stub. It was not an error, only an
IMPORT_IS_UNDEFINED warning from claude-agent-provider.ts, but the binding
resolved to undefined rather than to a named error.
Enumerated the missing exports from the build rather than fixing them one
crash at a time, and proved the check catches this: removing readSync alone
puts the build back to "not exported by fs-stub.js".
web build: exit 0, no MISSING_EXPORT, no IMPORT_IS_UNDEFINED.
npm run lint: 0 errors.
No test covered this. `npm run build` for web is not in the four mandatory
post-change checks, and only the Docker leg runs it on a PR.1 parent f0adde1 commit 249b2f6
4 files changed
Lines changed: 24 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | | - | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | | - | |
| 53 | + | |
| 54 | + | |
53 | 55 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
| |||
0 commit comments