Skip to content

fix: binary build fails — Gitea/GitLab adapter subpath exports not resolved by bun bundler #1040

@Wirasm

Description

@Wirasm

Summary

Binary builds (scripts/build-binaries.sh) fail because bun build --compile cannot resolve deep wildcard subpath exports from @archon/adapters.

Error

55 | import { GiteaAdapter } from '@archon/adapters/community/forge/gitea';
                                  ^
error: Could not resolve: "@archon/adapters/community/forge/gitea". Maybe you need to "bun install"?
    at packages/server/src/index.ts:55:30

56 | import { GitLabAdapter } from '@archon/adapters/community/forge/gitlab';
                                   ^
error: Could not resolve: "@archon/adapters/community/forge/gitlab". Maybe you need to "bun install"?
    at packages/server/src/index.ts:56:31

Root Cause

packages/adapters/package.json uses a wildcard export map:

"exports": {
  ".": "./src/index.ts",
  "./*": "./src/*"
}

This works at Bun runtime (e.g. bun dev, bun -e "import ..." from packages/server/) but bun build --compile from the repo root cannot resolve the deep subpath @archon/adapters/community/forge/gitea through the wildcard.

The adapters exist at packages/adapters/src/community/forge/gitea/ and packages/adapters/src/community/forge/gitlab/ — the files are all there. They're just not reachable by the bundler.

Reproduction

# From repo root:
bun build --compile --target=bun-darwin-arm64 --outfile=/dev/null packages/cli/src/cli.ts
# Fails with the above errors

# But runtime resolution works fine:
cd packages/server && bun -e "import { GiteaAdapter } from '@archon/adapters/community/forge/gitea'; console.log('OK:', typeof GiteaAdapter);"
# OK: function

Fix Options

  1. Add explicit export entries in packages/adapters/package.json:

    "exports": {
      ".": "./src/index.ts",
      "./*": "./src/*",
      "./community/forge/gitea": "./src/community/forge/gitea/index.ts",
      "./community/forge/gitlab": "./src/community/forge/gitlab/index.ts"
    }
  2. Re-export from main index — add GiteaAdapter and GitLabAdapter to packages/adapters/src/index.ts and update the imports in packages/server/src/index.ts.

Option 1 is the minimal change; option 2 is more consistent with how other adapters are exported.

Impact

  • Binary builds are broken on dev
  • CI release workflow will fail on next release tag
  • bun dev and runtime are unaffected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions