Skip to content

Fix crash in Bun.build with custom conditions - #30528

Closed
robobun wants to merge 1 commit into
mainfrom
farm/b26c0a16/fix-esm-conditions-capacity
Closed

Fix crash in Bun.build with custom conditions#30528
robobun wants to merge 1 commit into
mainfrom
farm/b26c0a16/fix-esm-conditions-capacity

Fix crash in Bun.build with custom conditions

481e3b2
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed May 12, 2026 in 9m 29s

Code review found 2 potential issues

Found 5 candidates, confirmed 2. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 1
Severity File:Line Issue
🟡 Nit test/bundler/bun-build-api.test.ts:653 New test should use test.concurrent
🟣 Pre-existing src/bundler/options.zig:1090 Same if-expression precedence bug in loadersFromTransformOptions

Annotations

Check warning on line 653 in test/bundler/bun-build-api.test.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

New test should use test.concurrent

nit: Per `test/CLAUDE.md`, tests that spawn processes or write files should use `test.concurrent` — the nearly-identical test just above (`loader map with an empty-string key...`) follows that pattern. Consider switching this to `test.concurrent` for consistency and to avoid serializing the suite.

Check notice on line 1090 in src/bundler/options.zig

See this annotation in the file changed.

@claude claude / Claude Code Review

Same if-expression precedence bug in loadersFromTransformOptions

Heads up: the same `if`-expression precedence footgun also exists in `loadersFromTransformOptions` in this file (`input_loaders.extensions.len + if (target.isBun()) default_loader_ext_bun.len else 0 + if (target == .browser) ... else 0 + default_loader_ext.len`). It doesn't crash there because the inserts use `getOrPutValue` rather than `putAssumeCapacity`, so it just under-reserves and rehashes — but since this PR is specifically about this parsing gotcha, it might be worth fixing that occurren