[PR #11364] fix(plugin): correct exports to point to dist instead of src #13756

Closed
opened 2026-02-16 18:18:35 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11364

State: closed
Merged: No


Summary

Fixes the Cannot find module '@opencode-ai/plugin' error when using custom tools in .opencode/tool/.

Problem

The package.json exports were pointing to source files:

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

But the published package only includes dist/ (via "files": ["dist"]), so the source files don't exist in the installed package.

Fix

Updated exports to point to the compiled dist files with proper types:

"exports": {
  ".": {
    "types": "./dist/index.d.ts",
    "import": "./dist/index.js"
  },
  "./tool": {
    "types": "./dist/tool.d.ts",
    "import": "./dist/tool.js"
  }
}

Testing

  • Built the package and installed from tarball locally
  • Verified custom tools in .opencode/tool/ can now import @opencode-ai/plugin without errors
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11364 **State:** closed **Merged:** No --- ## Summary Fixes the `Cannot find module '@opencode-ai/plugin'` error when using custom tools in `.opencode/tool/`. ## Problem The `package.json` exports were pointing to source files: ```json "exports": { ".": "./src/index.ts", "./tool": "./src/tool.ts" } ``` But the published package only includes `dist/` (via `"files": ["dist"]`), so the source files don't exist in the installed package. ## Fix Updated exports to point to the compiled dist files with proper types: ```json "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" }, "./tool": { "types": "./dist/tool.d.ts", "import": "./dist/tool.js" } } ``` ## Testing - Built the package and installed from tarball locally - Verified custom tools in `.opencode/tool/` can now import `@opencode-ai/plugin` without errors
yindo added the pull-request label 2026-02-16 18:18:35 -05:00
yindo closed this issue 2026-02-16 18:18:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13756