Repository navigation
Conversation
…solve Transpiler::enqueue_entry_points printed resolve failures (and entry points disabled by the browser field) straight to stderr without adding them to the log, so BuildCommand, which derives the exit code from log.errors, went on to report "Transpiled file" and exit 0. Route both cases through the log: entry points are now resolved with resolve_entry_point, the same helper bundling mode uses, so the error line and the exit code match `bun build` without --no-bundle.
|
Updated 11:01 PM PT - Aug 14th, 2026
🔄 @robobun, the build for |
|
Warning Review limit reached
Next review available in: 14 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
Comment |
|
Status: ready for review; the diff is final and green everywhere CI ran it. Reproduced on the released binary and on a debug build of main: in an empty directory, Scope, after self-review: the PR changes only Tests: five cases in CI for a82ed57 (build 97467): 177 of 179 jobs passed, including |
There was a problem hiding this comment.
Beyond the inline nit, I also traced the mixed-entry --outdir case through TransformResult::init → result.errors → the !result.errors.is_empty() early exit in build_command.rs — the logged error is copied into result.errors, so the build exits 1 before the write loop and the present.js-not-written assertion is load-bearing, not a side effect of the pre-existing --no-bundle --outdir ENOENT bug.
Extended reasoning...
The one inline finding (the MAX_PATH_BYTES guard arm in resolve_entry_point returning Err without logging) is a pre-existing gap that also affects bundling mode; this PR newly routes --no-bundle through it, so a >1 KB (macOS) / >4 KB (Linux) entry-point argument now goes fully silent where it previously at least hit pretty_error!. It's a genuine edge case and a one-line fix, so I'm leaving it as a nit rather than approving over it. The core change — swapping the direct resolver.resolve + pretty_error! for resolve_entry_point and add_error_fmt — is correct, matches what BundleV2 already does, and the four new tests cover the variant matrix (stdout, --outfile, mixed --outdir, browser-field disable).
…ath too The arm that skips the directory-cache retry for over-long specifiers returned before reporting, so bun build went on with no entry points and a Worker error event carried "BuildMessage: undefined".
There was a problem hiding this comment.
LGTM — the earlier finding (the over-long-specifier arm returning without logging) is addressed in 28d6847, and the comment-cop notes are resolved in e6bbc9d.
What was reviewed:
resolve_entry_point: confirmed the length check now only short-circuits the cache-bust retry viabreak 'name false, so control always reachesadd_error_fmton failure.enqueue_entry_points: the removedtop_level_dirlocal had no other uses;_resolve_entry_pointstill resolves withImportKind::EntryPointBuildfromtop_level_dir, so success-path semantics match bundling mode.- Other
resolve_entry_pointcallers (bundle_v2,web_worker,test_command) only see the over-long-specifier change, which is now logged instead of silently dropped — covered by the new bundler and worker tests.
Extended reasoning...
Overview
Two hunks in src/bundler/transpiler.rs plus tests. In enqueue_entry_points (the --no-bundle path), the direct resolver.resolve + pretty_error! is replaced with self.resolve_entry_point(entry), the same helper bundling mode uses, so a resolve failure is recorded in the log and the existing log.has_errors() check in BuildCommand exits 1. The browser-field-disabled arm is likewise switched from pretty_error! to log.add_error_fmt. In resolve_entry_point itself, the MAX_PATH_BYTES length guard moves from a match arm that returned Err without logging into the labelled retry block, where it only skips the cache-bust retry; the trailing add_error_fmt now runs on every failure path. Five tests in test/bundler/cli.test.ts and two in test/js/web/workers/worker.test.ts cover the missing-entry, --outfile, --outdir mixed-entry, browser-field, and over-long-name cases.
Security risks
None. No untrusted-input parsing, allocation sizing, or privilege boundaries are changed; the only behaviour change is that failures which previously went to stderr (or nowhere) are now recorded in the build log.
Level of scrutiny
Moderate. resolve_entry_point is shared by BundleV2 (all three enqueue_entry_points_* variants), the Worker entry resolver, and bun test, so the second hunk's blast radius is wider than --no-bundle. I traced each caller: they all already do Err(_) => continue and rely on the helper to log, so the moved length check is a strict improvement (silent → logged) for them. The enqueue_entry_points hunk is confined to Transpiler::transform, whose only caller is the --no-bundle branch of BuildCommand. _resolve_entry_point uses resolve_with_framework with ImportKind::EntryPointBuild and the same top_level_dir, so success-path resolution matches what bundling already does; the added ./ retry and cache bust only run after the first resolve fails.
Other factors
My previous review flagged the un-logged guard arm; that thread and the two comment-cop threads are all resolved by 28d6847 and e6bbc9d, and the current diff reflects those fixes. Test coverage follows REVIEW.md conventions (describe.concurrent, tempDir, combined-object assertions, Buffer.alloc for the long name, exit-code asserted last). The one CI failure so far is test/bake/deinitialization.test.ts segfaulting on Windows x64, which is unrelated to entry-point resolution and not touched by this diff.
…-no-bundle entries resolve_entry_point is back to what main has: #38391 already carries the same change with tests that also cover Windows and Bun.build. The browser field message gets the same "(entry point)" suffix #38778 uses, and the new test pins that --no-bundle now resolves "entry" to entry.ts the way a bundling build does.
There was a problem hiding this comment.
LGTM — the follow-up commit addressed my earlier note by splitting the resolve_entry_point over-long-specifier arm to #38391 (and the author's point that --no-bundle panics in normalize_entry_point_path → fs.abs() before ever reaching that arm holds, so there is no regression here). One nit: the PR description still describes the resolve_entry_point change, the worker.test.ts test, and the 5000-byte-name bundling test that a82ed57 backed out — worth trimming before merge.
What was reviewed:
enqueue_entry_pointsnow delegates toresolve_entry_point; on success this is the sameresolve_with_frameworkcall plus failure-only./-retry and cache-bust, so existing entry points resolve the same way (framework built-ins are not set for--no-bundle).- Confirmed the removed
top_level_dirlocal is dead —_resolve_entry_pointreads the same field fromself.fs(). - Checked that the browser-field arm's new
add_error_fmtmatches how the resolve failure is logged (sameNonesource,Loc::EMPTY, "(entry point)" suffix). - Tests: five subprocess cases covering stdout /
--outfile/ mixed--outdir/ browser-field / extensionless, all draining stdout+stderr+exited concurrently and usingtempDirper the harness conventions.
Extended reasoning...
Overview
The PR now touches exactly two places: Transpiler::enqueue_entry_points in src/bundler/transpiler.rs (~20 lines net) and a new describe.concurrent block in test/bundler/cli.test.ts (five subprocess tests). The Rust change replaces a direct resolver.resolve + pretty_error! with the shared resolve_entry_point helper — the same one BundleV2::enqueue_entry_points_normal uses — and swaps the browser-field pretty_error! for log_mut().add_error_fmt. Both failures now land in the build Log, so BuildCommand::exec's existing log.has_errors() check exits 1 and prints the same message bundling mode does. Earlier commits in the branch also touched resolve_entry_point and worker.test.ts, but a82ed57 reverted those in favor of #38391, so the net diff is just what's above.
Security risks
None. This is CLI error-reporting plumbing: no new parsing, no allocation on untrusted sizes, no unsafe, no FFI. The entry-point string is only formatted into a diagnostic via bstr::BStr.
Level of scrutiny
Low-to-moderate. enqueue_entry_points is only reached from Transpiler::transform, whose only caller is the --no-bundle branch of BuildCommand — no runtime, bundler, or worker paths flow through the changed lines. The success path is behavior-preserving: _resolve_entry_point calls resolve_with_framework (identical to resolve when opts.framework is unset, which it is for --no-bundle), and the ./-retry and cache-bust only fire after a failure, so they can only turn a failure into a success, never the reverse. The extensionless test pins that.
Prior review follow-up
My earlier inline comment flagged that resolve_entry_point's length-guard arm returns Err without logging. The author fixed it in 28d6847, then moved that fix to #38391 in a82ed57. For this PR's scope that is fine: --no-bundle calls normalize_entry_point_path first, which hits fs.abs() and panics on an over-long argument before resolve_entry_point is reached (on main too), so this PR neither improves nor regresses that input. All inline threads on the PR are resolved.
Other factors
Tests follow the repo's harness conventions (tempDir, bunEnv, await using on the spawned process, concurrent drain of stdout/stderr/exited, exit-code asserted alongside output in one toEqual) and cover the variant matrix the review guide asks for: bare stdout, --outfile (asserts nothing written), mixed good+missing with --outdir (asserts the good entry is not written either, matching bundling), the browser-field arm, and a positive extensionless case. The author reports these fail under USE_SYSTEM_BUN=1 and pass on the debug build, and an earlier CI run had the changed files green on every completed lane. The PR description is stale relative to a82ed57 but the code itself is small and self-contained enough to approve.
|
Heads-up from #38778: that PR makes |
…linking zero entry points (#39799) ### Problem - `bun build` and `Bun.build()` abort with `panic: index out of bounds: the len is 0 but the index is 0` in `generate_chunks_in_parallel` (`generateChunksInParallel.rs:64`, `chunks[0]`) when every entry point is dropped (Sentry BUN-3RAS). With a live entry point beside it, the build exits 0 and silently emits fewer outputs. - Three producers drop an entry point without a log entry, so the drivers link with `graph.entry_points` empty: (a) a result with every path disabled (`"browser": {"./a.ts": false}`, or `fs` / `node:*` under the browser target); (b) an onResolve plugin that returns `external: true` for it; (c) an over-long specifier, which `resolve_entry_point` returned before it logged. ### Fix - `resolve_entry_point` rejects a disabled result: `"./a.ts" is disabled due to "browser" field in package.json (entry point)` or `Cannot use Node.js builtin "fs" as an entry point`. This covers the CLI, `Bun.build()` and the plugin fallback. It makes two no-path arms unreachable, so they are deleted: the `Ok(None)` return in `enqueue_entry_item` (the old drop site) and the `Worker entry point is missing` arm in `web_worker.rs`. - `on_resolve` logs `The entry point "x" cannot be marked as external` (esbuild's error). The length guard now only skips the cache bust, so an over-long entry point logs `ModuleNotFound` like any missing one. - Backstop: both drivers fail with `None of the entry points could be bundled` when no entry point survives parsing. The linker's `debug_assert` stays. The CLI drivers check the log after `wait_for_parse()`, as the JS driver did, so no parse task is in flight at teardown. - Verified: `test/bundler/bundler_browser.test.ts`, `bundler_plugin.test.ts`, `bun-build-api.test.ts`, `test/js/web/workers/worker.test.ts` (new cases, all red on 1.4.0). Other suites: see notes. ### Background - A disabled module is how the resolver represents `"browser": false` and browser-stubbed builtins: `Result::path()` is `None` and an import of it becomes `{}`. An entry point has nothing to emit in that state. - `enqueue_entry_item` appends each resolved entry point to `graph.entry_points` (a plugin answer arrives in `on_resolve` instead). The drivers wait for parsing, fail if the log has errors, then link. The linker needs one entry point, so every drop has to log. Supersedes #38778 and #38391. Carries the entry point arm of #35053, whose import path rewrite is independent. <details><summary>Notes</summary> Repros on 1.4.0 (each exits 134, now exits 1 or returns `success: false` with one message): ```sh bun -e 'await Bun.build({entrypoints:["node:fs"]})' bun build node:fs bun build fs echo '{"browser":{"./a.ts":false}}' > package.json; bun build --target=browser ./a.ts bun -e 'await Bun.build({entrypoints:["./b.ts"], plugins:[{name:"x", setup(b){ b.onResolve({filter:/b\.ts$/}, a => ({path:a.path, external:true})) }}]})' bun -e 'await Bun.build({entrypoints:["a".repeat(5000)]})' ``` Local debug build only: three `terminate()` tests in `worker.test.ts` (message flood, preload with un-awaited `import()`, `fs.readFile` completions) fail in this container, and fail the same way with the unmodified main sources built here. `production > works with sourcemaps` in `test/bake/dev/production.test.ts` hits its 5 s budget here and passes in 5.07 s with a longer one, with the expected `oh no!` output. The release binary passes all four. None of them involve entry point resolution. Other suites run on the debug build: `bundler_edgecase`, `bundler_naming`, `bundler_html`, `cli`, `test/bake/dev-and-prod`, and the three bundler files above in full. 1.3.x had the same drops and returned `success: true, outputs: []`. The port added the bounds check, so the drop now aborts. Silent drop on 1.4.0: `bun build --target=browser ./a.ts ./b.ts --outdir=out` exits 0 and writes only `b.js`. Now it exits 1 with the `./a.ts` error and writes nothing. The plugin test and the browser tests pin this form too. Long directory form of (c): a cwd of 3835 bytes plus a 500 byte relative entry point (`top_level_dir + entry + 4 > MAX_PATH_BYTES`) aborts on 1.4.0 alone and is silently dropped next to a valid entry point. With this branch both report `ModuleNotFound resolving "./eee...js" (entry point)` from the CLI and from `Bun.build()`. The same entry point as a 4337 byte absolute path still aborts in `load_as_file` (`src/resolver/resolver.rs:5888`), the resolver overflow #39626 is for. A specifier longer than the buffer inside a package with a `browser` field aborts in `check_browser_map` (`resolver.rs:5108`), which #37532 is for. Neither is an entry point drop. Worker: the length guard also made `new Worker(longName)` fire its error event with `BuildMessage: undefined`. The worker test pins the message. Unchanged: `--external ./b.ts` or `external: ["*"]` on an entry point still bundles it (entry points are exempt from external patterns, #12734). An absolute entry point path is never looked up in the browser map, so the bake and dev server callers of `resolve_entry_point`, which pass absolute paths, cannot hit the new error. `node:path` under the browser target still bundles its polyfill. Backstop reachability: the only known route left is `bun build --target=bun bun:wrap` in a release build (the specifier collides with the runtime's `bun:wrap` map key, so `enqueue_entry_item` returns `Ok(None)`). A debug build trips `assert_file_path_is_absolute` on that input first, so the backstop has no debug-runnable test of its own. Builtin specifiers as entry points under `--target bun`/`node` are a separate, pre-existing problem and are reported separately. Teardown: `enqueue_entry_points_common` schedules the runtime parse task before any entry point is resolved. #38778 saw ASAN crashes in `Worker::deinit_soon` on the CLI error path while the drivers still returned before `wait_for_parse()`. With this branch under the ASAN debug build, 30/30 runs of `bun build --target=browser ./a.ts` exit 1 with the message, and 20/20 runs with two bad entry points report both errors. `USE_SYSTEM_BUN=1` (1.4.0): the two new bun-build-api tests fail (the child aborts), the plugin test fails (the child aborts), 4 of the 5 new bundler_browser cases fail (the `--target=bun` control passes both ways by design), the worker test fails with `BuildMessage: undefined`. #38752 (`--no-bundle`) keeps its own message in the transform path, which this change does not touch. </details> <!-- robobun:evidence:begin --> --- **no test proof** · iteration 0 · Platform-specific test(s) that do not run on this machine. Deferring to CI, which covers all platforms: test/bundler/bun-build-api.test.ts test/bundler/bundler_plugin.test.ts <!-- robobun:evidence:end --> --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
…external matches on entry points normally (#39811) ### Problem - `bun build --target=bun node:fs` (also `--target=node fs`, and `Bun.build()`) schedules the specifier as a file. A debug build aborts with `panic: assertion failed: crate::is_absolute(self.text)` in `Path::assert_file_path_is_absolute`, from `BundleV2::enqueue_entry_item`. A release build prints `File not found "node:fs"`. Still the case on main after #39799. - `bun build --target=bun bun:wrap` is dropped instead (the runtime is registered under that name). Main fails it with the backstop from #39799, which does not name the entry point. - Cause: under `--target bun`/`node` the resolver returns a builtin as an external result with the bare specifier as its path (`src/resolver/resolver.rs:1141`). An exact `--external` match on an entry point came back the same way (`:1971`, `:1805`, `:2066`). `resolve_entry_point` accepted both. ### Fix - The resolver skips the exact `--external` matches for an entry point, as it already skips the patterns (#12734, `resolver.rs:1207`). `--external pkg pkg` now bundles `pkg`. `--external ./a.tsx ./a.tsx` was bundled from the external result, which ignored its tsconfig. It now resolves normally. - A builtin is now the only external result an entry point can get. `_resolve_entry_point` tries a bare name as `./name` first, as it does for a name that is not a package, so `bun build util` builds a local `util.ts`. Otherwise the helper from #39799 that rejects a disabled entry point rejects it too. - One message for both: `Cannot use "fs" as an entry point: it resolves to a builtin module`. The browser wording from #39799 said `Node.js builtin`, which does not fit `bun:sqlite`, so it changes to this one (`bundler_browser.test.ts` updated). A `data:` URL that is not code is the one other external result and is reported as `ModuleNotFound`. - Correct because an entry point has to be parsed, and an external result is the one thing the bundler leaves unparsed. Every caller shares this function: `new Worker("#fs")`, with an `imports` alias of `node:fs`, now fires an error event like `new Worker("node:fs")`. - Verified: `test/bundler/bundler_edgecase.test.ts` (8 cases), `bun-build-api.test.ts`, `workers/worker-entry-point.test.ts`, all red with this PR's `src/` stashed on main. Other suites: see the notes. ### Background - Under `--target bun`/`node` a builtin stays an import in the output. The resolver returns it with the `IS_EXTERNAL` flag. The import code checks the flag. The entry point code did not. - `--external` is two exact match sets (package names, absolute files) plus wildcard patterns. Only the patterns had the entry point exemption. - The worker case exposed a resolver leak on the ASAN lanes. #39947 (merged) fixed it, and this PR's worker case sits next to that one in `worker-entry-point.test.ts`. <details><summary>Notes</summary> Behaviour per input on main (4448a2e, debug build unless noted) and on this branch: ```sh bun build --target=bun node:fs # assert (release: File not found "node:fs") -> Cannot use "node:fs" as an entry point: it resolves to a builtin module bun build --target=node fs # same -> same error bun build --target=bun bun:wrap # assert (release: None of the entry points could be bundled) -> error naming "bun:wrap" bun build --target=bun '#fs' # same as node:fs, with "imports": {"#fs": "node:fs"} -> error naming "#fs" bun build --target=bun util # util.ts present: assert / File not found -> bundles util.ts bun build --external pkg pkg # assert / File not found "pkg" -> bundles node_modules/pkg (not installed: ModuleNotFound resolving "pkg" (entry point)) bun build --external ./a.tsx ./a.tsx # bundled, tsconfig jsxFactory ignored -> bundled with it bun build --external a.ts a.ts # assert (release: read "a.ts" relative to the cwd) -> resolved as ./a.ts bun build ./valid.js 'data:image/png;base64,...' # emitted a module exporting "" into a directory named data:image -> ModuleNotFound resolving "data:image/..." (entry point) bun build --target=browser fs # Cannot use Node.js builtin "fs" as an entry point (#39799) -> the unified message ``` A lone `data:` entry point fails before resolution, when the build opens its root directory. It only reaches this code next to another entry point. Shape: an earlier revision of this PR added its own check and error variant next to #39799's helper and moved the length guard, which #39799 then landed. Both are gone. The transpiler delta is now the `./name` retry for a builtin result, the data: URL arm, and the `is_external()` arm in the helper. The disabled result keeps #39799's flow (no retry, reported at once). A builtin result takes the retry first because, unlike a disabled file, a bare builtin name is routinely also a local file name. `--no-bundle` resolves entry points on its own (`Transpiler::enqueue_entry_points`) without `mark_builtins_as_external`, so it reports `node:fs` as `ModuleNotFound` today. #38752 moves it onto `resolve_entry_point`. The plugin path that marks an entry point external (`on_resolve`) is covered by #39799. Worker preloads resolve through the same function. A preload given as an `imports` alias of a builtin now fails to resolve, as a bare `fs` or `bun:sqlite` preload already does. Only `node:` prefixed preloads skip the resolver. Suites run on the debug build of this branch: `bundler_edgecase`, `bun-build-api`, `bundler_browser` (each in full), `bundler_plugin`, `esbuild/packagejson`, `cli`, `worker-entry-point`. The worker case is in the file #39947 added instead of `worker.test.ts`: three stress cases there go over their budget on a debug build on a slow machine, which hides whether a new case flips. The earlier revision also ran `esbuild/default`, `bundler_npm`, `bundler_regressions`, `bundler_naming`, `bundler_html`, `test/js/bun/resolve/`, `bake/dev/bundle`, `bake/dev-and-prod` with the same resolver change. </details> <!-- robobun:evidence:begin --> --- **no test proof** · iteration 1 · platform-specific test(s) that do not run on this machine, deferring to CI, which covers all platforms: test/bundler/bundler_edgecase.test.ts, test/bundler/bun-build-api.test.ts <!-- robobun:evidence:end -->
|
Closing this PR because it has been inactive for more than 90 days. |
Problem
bun build --no-bundle missing.tsprintsError resolving "missing.ts": ModuleNotFound, thenTranspiled file in 1ms, and exits 0. Same with--outfile(nothing is written) and with--outdirand several entries. Scripts runningbun build --no-bundleover a file list cannot detect a bad path.bun build missing.ts(bundling) printserror: ModuleNotFound resolving "missing.ts" (entry point)and exits 1.Transpiler::enqueue_entry_points(src/bundler/transpiler.rs) resolves each entry point with a bareresolver.resolvecall and, on failure, writes to stderr withpretty_error!andcontinues without adding anything to the log. The--no-bundlebranch ofBuildCommand::exec(src/runtime/cli/build_command.rs,if log_ref.has_errors()) only exits 1 when the log has errors, so the build is reported as successful."..." is disabled due to "browser" field in package.jsonarm a few lines below has the same problem: an entry point disabled by the browser field also exited 0.resolver.resolvecall is also less capable than bundling mode's entry point resolution:bun build --no-bundle entry(orentry.jsfor anentry.ts, orlib/util) fails with the same silent exit 0, whilebun build entryresolves it.Fix
enqueue_entry_pointsresolves each entry point withTranspiler::resolve_entry_point, the helper bundling mode (BundleV2::enqueue_entry_points_normal) uses. It records the failure in the log, so the existinghas_errors()check inBuildCommandprints it and exits 1, and the error line is the same in both modes. Because it also retries with a./prefix before giving up, extension-less and extension-remapped entries now transpile under--no-bundleexactly as they bundle without it.add_error_fmt, with the same(entry point)suffix the other entry point errors carry.bun buildis derived from the log in both modes. An error that only goes to stderr is invisible to that check, so any failure this path wants to fail the build on has to be logged (same shape as bundler: fail the build when a module fails to print instead of emitting truncated output #37036, which did this for print failures one step later in the same path). Logging instead of adding a second exit-code source inBuildCommandalso keeps the mixed case consistent with bundling: with one good and one missing entry, nothing is written and the command exits 1 in both modes.enqueue_entry_pointsis only reached fromTranspiler::transform, whose only caller is the--no-bundlebranch ofBuildCommand.resolve_entry_pointitself is not modified here. Relative to the replaced call, the only success-path difference is the./retry described above; everything else differs only after the first resolve has failed.resolve_entry_pointlog for specifiers too long for a path buffer (an earlier revision of this PR carried the same change; dropped in favour of that PR, whose tests also cover Windows andBun.build). bundler: fail the build when an entry point has no module to bundle #38778 makesresolve_entry_pointitself reject browser-field-disabled entry points with the message used here; once both are in, the browser-field arm inenqueue_entry_pointsis unreachable and whichever PR lands second deletes it. bun build --no-bundle: write output files when --outdir is set #35644 makes--no-bundle --outdirwrite files at all; the--outdirtest here asserts on the exit taken before the write loop, so it holds with and without it.test/bundler/cli.test.ts, five cases: missing entry to stdout, with--outfile, with--outdirplus an existing second entry (nothing written), an entry disabled by the browser field, andentryresolving toentry.ts. All five fail on the released binary (exit 0 or no output) and pass with the debug build.test/bundler/cli.test.ts,test/regression/issue/{23569,29242,31401}.test.ts,test/bundler/transpiler/transpiler-stack-overflow.test.ts, and the itBundled suites that containbundling: falsecases (esbuild/{default,lower,ts,dce,loader,importstar,importstar_ts}.test.ts,bundler_jsx,bundler_string,bundler_minify_symbol_for; these pass absolute entry paths through the changed code): 0 failures.Background
--no-bundlemakesbun buildtranspile each entry point on its own instead of bundling. It takes a separate code path:Transpiler::transformin src/bundler/transpiler.rs (resolve the entry points, transpile each one, collectOutputFiles), while bundling goes throughBundleV2.bun_ast::Log) is the list of build messages shared by the resolver, parser, and printer.BuildCommandprints it at the end and useslog.errorsto decide the exit code; output written straight to stderr is not part of it.Transpiler::resolve_entry_pointresolves an entry point specifier, retries with a./prefix if it did not resolve as a package, busts the resolver's directory cache and retries once more, and logs<error> resolving "<entry>" (entry point)if it still fails. Bundling mode has used it for entry points all along.browserfield can map a file tofalse, which tells the resolver the module is disabled for browser targets; the resolver then returns a result with no path.Before / after, and neighbouring bugs not changed here
Neighbouring bugs noticed on the way, each owned elsewhere:
resolve_entry_pointreturns without logging for specifiers too long for a path buffer: bundler: log the resolve error for an entry point too long for a path buffer #38391.bun build --no-bundle <5000-byte name>panics before reaching the resolver, innormalize_entry_point_path->fs.abs(), on main as well: the join primitive is being bounded in bun test: stop panicking on a path argument or tree entry longer than the path buffer #35863, after which this PR's routing makes that case exit 1 too.--no-bundle --outdirwrites nothing at all (ENOENT: failed to write file '""'): bun build --no-bundle: write output files when --outdir is set #35644.no test proof · iteration 0 · Platform-specific test(s) that do not run on this machine. Deferring to CI, which covers all platforms: test/bundler/cli.test.ts