Skip to content

Add exports map so OpenCode 2 loader resolves the package entry - #52

Merged
Mte90 merged 1 commit into
Mte90:masterfrom
San4es:feat/opencode-v2-exports
Nov 19, 2026
Merged

Mte90 merged 1 commit into
Mte90:masterfrom
San4es:feat/opencode-v2-exports

Conversation

@San4es

@San4es San4es commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Summary

The OpenCode 2 plugin loader resolves published packages through the package exports map (subpath "." = package root), not the legacy main field. This package ships only main (dist/index.js), so the loader never reaches the module that holds the valid plugin default and fails with:

Plugin must export a default definition with an id and an effect or setup function.
(cause: SchemaError(Expected object at ["default"]))

This PR adds an exports map pointing at the entry that already exposes the dual-shape default ({ id, server, setup }):

"exports": {
  ".": "./dist/index.js"
}

The V1 plugin (server) and the V2 entrypoint (setup) are both preserved in the default export — this change only makes the package resolvable by the OpenCode 2 loader.

@Mte90
Mte90 merged commit 0a0b5c6 into Mte90:master Nov 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants