Repository navigation
fix(build): the OpenCode build sees the ESM-only plugin package when it is installed - #2025
Merged
Merged
Conversation
…it is installed Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
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. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Why
Packing main a28d3de for the PC after #2024,
npm packprintedSKIP: 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.jsdecided presence with a CommonJSrequire.resolve('@opencode-ai/plugin'), and the package is ESM-only ("type": "module") with anexportsmap that offers onlyimportconditions, 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:hasOpencodePeerlooks for the package's ownpackage.jsonundernode_modules/@opencode-ai/pluginin the same directories the compiler resolves from (.opencodefirst, 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.jsonexists.CHANGELOG.mdanddocs/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.jsfrom the clone, package installed: noSKIP, dist built with the plugin's TypeScript 5.9.node tests/scripts/build-opencode.test.js: 4 passed, 0 failed.