# Plugins

**TL;DR:** in jbrowse-web and jbrowse-desktop, add a plugin by listing its
`name` (which must match the name the plugin registers itself under) and bundle
`url` in the top-level `plugins` array.

```json
{
  "plugins": [
    {
      "name": "GDC",
      "url": "https://unpkg.com/jbrowse-plugin-gdc/dist/jbrowse-plugin-gdc.umd.production.min.js"
    },
    {
      "name": "MyPlugin",
      "esmLoc": { "uri": "plugin.js" }
    }
  ]
}
```

- **`name` must match the plugin's own registration** (`name = 'GDC'` in the
  plugin class), or the plugin fails to load.
- **The [plugin store](https://jbrowse.org/jb2/plugin_store/) lists unpkg URLs** for published plugins,
  which you can also download to your own server. Plugin authors submit a PR to
  [jbrowse-plugin-list](https://github.com/GMOD/jbrowse-plugin-list).
- **Embedded components load plugins inline**; see the
  [inline plugins example](https://jbrowse.org/storybook/lgv/plugins/#with-inline-plugins).

`url` is the simplest field and equals `umdUrl`. The others differ in module
format and in what the path resolves against:

| Field    | Module format | Path resolved relative to |
| -------- | ------------- | ------------------------- |
| `url`    | UMD           | index.html                |
| `umdUrl` | UMD           | index.html                |
| `umdLoc` | UMD           | config.json               |
| `esmUrl` | ESM           | index.html                |
| `esmLoc` | ESM           | config.json               |
| `cjsUrl` | CJS           | index.html (desktop only) |

`umdLoc`/`esmLoc` suit a plugin file that lives beside config.json, and `cjsUrl`
is for jbrowse-desktop, since Electron does not load ESM.

<Figure src="/img/plugin_store.png" caption="Opening the plugin store from the Tools menu. Plugins installed via the config (here UMDUrlPlugin) show a lock icon in the Installed plugins section, indicating they cannot be removed through the GUI. The Available plugins list below offers one-click installs."/>

## See also

- [](https://jbrowse.org/jb2/docs/user_guides/plugin_store)
- [](https://jbrowse.org/jb2/docs/developer_guide/)
- [No-build plugin](https://jbrowse.org/jb2/docs/developer_guides/no_build_plugin)
- [Simple plugin tutorial](https://jbrowse.org/jb2/docs/developer_guides/simple_plugin)

