Skip to content

fix(build): the OpenCode build sees the ESM-only plugin package when it is installed - #2025

Merged
Fmarzochi merged 1 commit into
mainfrom
fix/opencode-peer-detection
Oct 24, 2026
Merged

Fmarzochi merged 1 commit into
mainfrom
fix/opencode-peer-detection

Conversation

@Fmarzochi

Copy link
Copy Markdown
Owner

Why

Packing main a28d3de for the PC after #2024, npm pack printed SKIP: build-opencode (@opencode-ai/plugin not installed; set EGC_OPENCODE_BUILD=required to force) while the package was installed under .opencode/node_modules. scripts/build-opencode.js decided presence with a CommonJS require.resolve('@opencode-ai/plugin'), and the package is ESM-only ("type": "module") with an exports map that offers only import conditions, so the resolve throws even when the package is there. The release pipeline is unaffected since #2022 (it forces the build), but a local pack without a dist already on disk shipped none, and the message blamed a missing package that was installed.

What changes

  • scripts/build-opencode.js: hasOpencodePeer looks for the package's own package.json under node_modules/@opencode-ai/plugin in the same directories the compiler resolves from (.opencode first, the root second), instead of resolving the ESM entry from CommonJS.
  • tests/scripts/build-opencode.test.js: the build case fails if the script prints the skip while .opencode/node_modules/@opencode-ai/plugin/package.json exists.
  • CHANGELOG.md and docs/ROADMAP.md: the entry (fix(build): the OpenCode build sees the ESM-only plugin package when it is installed #2025).

Proof

  • node scripts/build-opencode.js from the clone, package installed: no SKIP, dist built with the plugin's TypeScript 5.9.
  • node tests/scripts/build-opencode.test.js: 4 passed, 0 failed.
  • eslint clean; no em or en dash in the changed files.

…it is installed

Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

@Akisolu this pull request touches an area you steward (docs/governance/stewards.md): a review from you is welcome. The repository mentions you because a formal review request needs a collaborator.

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Fmarzochi
Fmarzochi merged commit 36c17e5 into main Oct 24, 2026
36 checks passed
@Fmarzochi
Fmarzochi deleted the fix/opencode-peer-detection branch October 24, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant