Skip to content

Regression in 0.2.96: bun --compile fails due to missing ./tempfile.js import target #273

@apuigsech

Description

@apuigsech

Summary

Upgrading @anthropic-ai/claude-agent-sdk from 0.2.91 to 0.2.96 breaks Bun compiled builds (bun build --compile) because extractFromBunfs.js imports ./tempfile.js, but that file is not present in the published package.

Error:

17 | import { tmpdir } from './tempfile.js'
                            ^
error: Could not resolve: \"./tempfile.js\"
    at .../node_modules/@anthropic-ai/claude-agent-sdk/extractFromBunfs.js:17:24

Environment

  • macOS Darwin 25.2.0 (arm64)
  • Bun 1.3.10
  • @anthropic-ai/claude-agent-sdk 0.2.96
  • Tauri app sidecar compiled with Bun (bun build --compile)

Reproduction

  1. Install SDK 0.2.96:
bun add @anthropic-ai/claude-agent-sdk@0.2.96
  1. Use this minimal repro file (agent-bridge.repro.ts):
import cliPath from "@anthropic-ai/claude-agent-sdk/embed";
console.log("Embedded CLI path:", cliPath);
  1. Compile with Bun:
bun build --compile --target=bun agent-bridge.repro.ts --outfile /tmp/agent-bridge-repro
  1. Build fails with Could not resolve: "./tempfile.js".

Additional checks

  • In 0.2.96, extractFromBunfs.js imports ./tempfile.js.
  • tempfile.js is missing from package contents.
  • The package files list also does not include tempfile.js.
  • Rolling back to 0.2.91 restores successful compile in the same environment.

Expected behavior

bun build --compile should succeed with recent SDK versions, and all internal imports in published files should resolve.

Actual behavior

Build fails due to missing module in published artifact (./tempfile.js).

Related context

Looks related to earlier Bun bundling/runtime packaging concerns (e.g. #150), but this appears to be a different concrete failure mode (missing file in npm artifact).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions