You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1 | import { sum } from "@/utils";
^
error: Could not resolve: "@/utils". Maybe you need to "bun install"?
at /Users/admin/Desktop/bun-reproduce-build-api-custom-tsconfig-issue/src/index.ts:1:21
Bun v1.3.8 (macOS arm64)
Expected to resolve the path aliases correctly and build successfully.
What do you see instead?
The build fails with a resolution error (see error output in reproduction steps above).
Additional information
Interestingly, the tsconfig option in the Bun.build() API is equivalent to the --tsconfig-override option in the CLI. However, when building the same entrypoint using the CLI with --tsconfig-override, the path aliases resolve properly and the build succeeds.
For example, this command works:
bun build src/index.ts --tsconfig-override=tsconfig.custom.json --outdir=dist
However, I still see this grayed-out error in the CLI output:
Bundled 2 modules in 5ms
Internal error: directory mismatch for directory "/Users/admin/Desktop/bun-reproduce-build-api-custom-tsconfig-issue/tsconfig.custom.json", fd 3. You don't need to do anything, but this indicates a bug.
index.js 52 bytes (entry point)
changed the title [-]`tsconfig` option in `Bun.build` API not working[/-][+]`Bun.build()` `tsconfig` option doesn't resolve path aliases (CLI works)[/+]on Feb 7, 2026
What I ran, on Linux x64 (the report is from macOS): the four files from the report (build.ts, tsconfig.custom.json, src/index.ts, src/utils.ts), run with bun build.ts and with the report's bun build --tsconfig-override command.
Bun v1.3.8: fails the build with error: Could not resolve: "@/utils". Maybe you need to "bun install"?, and the CLI build with --tsconfig-override prints Internal error: directory mismatch.
main (d3d074e32): resolves @/utils through tsconfig.custom.json and writes dist/index.js with function sum() {} in three runs out of three, and the CLI build prints no internal error line.
The first release that passes is Bun v1.4.3.
The fix is #44361.
If this still fails for you on the latest Bun, comment here with the version and the output, and the issue can be reopened.
Activity
[-]`tsconfig` option in `Bun.build` API not working[/-][+]`Bun.build()` `tsconfig` option doesn't resolve path aliases (CLI works)[/+]jesterfraud commentedon Feb 19, 2026
I'm guessing we're relying on random chance for this issue being addressed out of the 4.8k open issues and 1.3k open pull requests right now. 🙁
robobun commentedon Nov 17, 2026
This is fixed on main.
What I ran, on Linux x64 (the report is from macOS): the four files from the report (
build.ts,tsconfig.custom.json,src/index.ts,src/utils.ts), run withbun build.tsand with the report'sbun build --tsconfig-overridecommand.error: Could not resolve: "@/utils". Maybe you need to "bun install"?, and the CLI build with--tsconfig-overrideprintsInternal error: directory mismatch.d3d074e32): resolves@/utilsthroughtsconfig.custom.jsonand writesdist/index.jswithfunction sum() {}in three runs out of three, and the CLI build prints no internal error line.The first release that passes is Bun v1.4.3.
The fix is #44361.
If this still fails for you on the latest Bun, comment here with the version and the output, and the issue can be reopened.