Skip to content

Conversation

@derekross
Copy link

Summary

Fixes the @opencode-ai/plugin package so it works when installed from npm.

Problem

The plugin package fails to load with error:

Cannot find module './tool' imported from .../node_modules/@opencode-ai/plugin/dist/index.js

Root causes:

  1. package.json exports pointed to ./src/index.ts but only dist/ is published to npm
  2. Compiled dist/index.js had export * from "./tool" without .js extension, which does not resolve in Node.js ESM

Solution

  1. Updated package.json exports to point to dist/*.js files with proper ESM conditional exports
  2. Added .js extensions to all relative imports in source files

Testing

Tested with opencode-shakespeare-plugin which was unable to load until this fix was applied.

Fixes #8006

The @opencode-ai/plugin package fails to load when installed from npm because:

1. package.json exports pointed to ./src/index.ts but only dist/ is published
2. Compiled dist/index.js had 'export * from "./tool"' without .js extension

This fix:
- Updates package.json exports to point to dist/*.js files
- Adds .js extensions to all relative imports in source files

Fixes anomalyco#8006
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

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.

@opencode-ai/plugin: ESM imports missing .js extension breaks plugin loading

1 participant