

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Plugins
incomplete
2: Loading Plugins
incomplete
3: Install Plugins
incomplete
4: Plugin Transforms
incomplete
5: Plugin Hooks
incomplete
6: Plugin Tools
incomplete
7: Publishing Plugins
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
An OpenCode plugin published on npm uses the same default export as a local plugin. So if you want to publish a plugin, you can treat it as a normal ECMAScript module (ESM), with the plugin runtime listed in dependencies:
{
"name": "my-slop-opencode-plugin",
"version": "0.1.0",
"type": "module",
"exports": "./dist/index.js",
"dependencies": {
"@opencode/plugin": "2.0.3"
}
}
The exports field identifies the file OpenCode loads. There are two options:
"exports": "./dist/index.js" as above, compile the plugin's TypeScript code, and include the generated files in the published package."exports": "./src/index.ts" and include the source files in the published package. OpenCode can load TypeScript directly.