Skip to main content
Version: 3.14 Beta (Latest)

Extension: Installation

Every installed extension is an entry in platform/app/pluginConfig.json and is compiled into the viewer at build time. There are three placement options, mirroring Plugin locations: install from npm, point at an out-of-tree checkout, or keep the package in-tree.

From npm​

Install the package at the workspace root, then declare it:

pnpm add -w @acme/extension-foo
platform/app/pluginConfig.json
{ "extensions": [ { "packageName": "@acme/extension-foo" } ] }

Or do both in one step with the helper:

pnpm run plugin add @acme/extension-foo

plugin add also installs and declares any OHIF extensions or modes the package lists as peers (pass --no-peers to add only the package you named).

From a local checkout (out-of-tree)​

Point the config at a checkout on disk:

pnpm run plugin link ../extension-foo

This adds a directory entry to pluginConfig.json. See Develop Out-of-Tree for the full workflow. The manual equivalent is:

platform/app/pluginConfig.json
{ "extensions": [ { "packageName": "@acme/extension-foo", "directory": "~/dev/extension-foo" } ] }

In-tree​

Copy or scaffold the package under extensions/ and declare it by packageName — the workspace glob already covers that directory:

node platform/create-ohif/bin/create-ohif.mjs my-extension --template extension --in-tree

See Create an Extension or Mode.

Check your setup​

pnpm run plugin list
pnpm run plugin doctor

doctor validates the pluginConfig.json schema, checks that every declared package resolves, verifies @ohif/core peer-range compatibility (prerelease versions included), and reports installed-but-undeclared packages that carry the ohif-extension or ohif-mode keyword. For each one it prints the exact JSON line to paste into pluginConfig.json; it never writes the file itself. Because installs are hoisted, a plugin's own dependencies are installed at the root too, so the warning says how each package got there: listed in the root or platform/app package.json, a dependency of a declared plugin, or an indirect dependency. A package that a plugin only imports as a library needs no entry.

Removing​

pnpm run plugin remove @acme/extension-foo

Install at runtime (no rebuild)​

Extensions can also be loaded into a running viewer without a rebuild. See Runtime Extensions.