Conversation
Greptile SummaryThis PR improves cross-platform compatibility by replacing the bash-only Key changes:
Remaining concern: The inner Confidence Score: 3/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: scripts/bundle-a2ui.mts
Line: 78-82
Comment:
**Catch-all swallows genuine build errors from rolldown**
The inner `catch` at line 80 catches **any** non-zero exit from `pnpm -s exec rolldown`, not only "rolldown binary not found in local node_modules." This means:
1. If rolldown is installed locally but the bundler config or source files have an error (syntax mistake, missing import, etc.), the first `exec` throws.
2. The `catch` silently falls back to `pnpm -s dlx rolldown`, potentially re-downloading rolldown.
3. `pnpm dlx rolldown` runs with the **same broken config**, fails again, and the outer `catch` finally surfaces the error.
Users see two sets of rolldown error output and a misleading "downloading rolldown" phase, making it look like the failure is a missing binary rather than a build problem.
A safer pattern is to probe for the binary's existence first, then choose the invocation path, rather than relying on a broad catch:
```typescript
import { existsSync } from "node:fs";
const rolldownLocalBin = path.join(ROOT_DIR, "node_modules/.bin/rolldown");
const rolldownCmd = existsSync(rolldownLocalBin)
? `"${rolldownLocalBin}"`
: `pnpm -s dlx rolldown`;
exec(`${rolldownCmd} -c "${path.join(A2UI_APP_DIR, "rolldown.config.mjs")}"`);
```
This way, rolldown build errors are always surfaced immediately without the confusing re-download detour.
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: 5dc8633 |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
| try { | ||
| exec(`pnpm -s exec rolldown -c "${path.join(A2UI_APP_DIR, "rolldown.config.mjs")}"`); | ||
| } catch { | ||
| exec(`pnpm -s dlx rolldown -c "${path.join(A2UI_APP_DIR, "rolldown.config.mjs")}"`); | ||
| } |
There was a problem hiding this comment.
Catch-all swallows genuine build errors from rolldown
The inner catch at line 80 catches any non-zero exit from pnpm -s exec rolldown, not only "rolldown binary not found in local node_modules." This means:
- If rolldown is installed locally but the bundler config or source files have an error (syntax mistake, missing import, etc.), the first
execthrows. - The
catchsilently falls back topnpm -s dlx rolldown, potentially re-downloading rolldown. pnpm dlx rolldownruns with the same broken config, fails again, and the outercatchfinally surfaces the error.
Users see two sets of rolldown error output and a misleading "downloading rolldown" phase, making it look like the failure is a missing binary rather than a build problem.
A safer pattern is to probe for the binary's existence first, then choose the invocation path, rather than relying on a broad catch:
import { existsSync } from "node:fs";
const rolldownLocalBin = path.join(ROOT_DIR, "node_modules/.bin/rolldown");
const rolldownCmd = existsSync(rolldownLocalBin)
? `"${rolldownLocalBin}"`
: `pnpm -s dlx rolldown`;
exec(`${rolldownCmd} -c "${path.join(A2UI_APP_DIR, "rolldown.config.mjs")}"`);This way, rolldown build errors are always surfaced immediately without the confusing re-download detour.
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/bundle-a2ui.mts
Line: 78-82
Comment:
**Catch-all swallows genuine build errors from rolldown**
The inner `catch` at line 80 catches **any** non-zero exit from `pnpm -s exec rolldown`, not only "rolldown binary not found in local node_modules." This means:
1. If rolldown is installed locally but the bundler config or source files have an error (syntax mistake, missing import, etc.), the first `exec` throws.
2. The `catch` silently falls back to `pnpm -s dlx rolldown`, potentially re-downloading rolldown.
3. `pnpm dlx rolldown` runs with the **same broken config**, fails again, and the outer `catch` finally surfaces the error.
Users see two sets of rolldown error output and a misleading "downloading rolldown" phase, making it look like the failure is a missing binary rather than a build problem.
A safer pattern is to probe for the binary's existence first, then choose the invocation path, rather than relying on a broad catch:
```typescript
import { existsSync } from "node:fs";
const rolldownLocalBin = path.join(ROOT_DIR, "node_modules/.bin/rolldown");
const rolldownCmd = existsSync(rolldownLocalBin)
? `"${rolldownLocalBin}"`
: `pnpm -s dlx rolldown`;
exec(`${rolldownCmd} -c "${path.join(A2UI_APP_DIR, "rolldown.config.mjs")}"`);
```
This way, rolldown build errors are always surfaced immediately without the confusing re-download detour.
How can I resolve this? If you propose a fix, please make it concise.
Summary
Change Type (select all)
Linked Issue/PR
Feature #48613
Changes
###package.json
update:
"canvas:a2ui:bundle": "node --import tsx scripts/bundle-a2ui.mts",
###openclaw\scripts\bundle-a2ui.mts***
create:
bundle-a2ui.mts
Security Impact (required)
If there is any risk, all you need to do is change "canvas:a2ui:bundle": "bash scripts/bundle-a2ui.sh", to "canvas:a2ui:bundle": "node --import tsx scripts/bundle-a2ui.mts",
OS:
Runtime/container: windows/Mac/Linux
Model/provider: zai
Verified scenarios: windows
Testing
All 39 unit tests in app-render.helpers.node.test.ts pass (36 existing + 3 new)