OHIF CLI removal
platform/cli (@ohif/cli) and the root cli script were deleted. The CLI was
never published (it was private: true) and its link commands had been broken
since the pnpm migration (they spawned yarn link).
Everything the CLI did is now covered by four things you can use directly:
pnpm add -w <pkg>to install a plugin at the workspace root,- an entry in
platform/app/pluginConfig.jsonto register it (edit the file directly, or use the helper), create-ohif(pnpm create ohif) to scaffold a new extension or mode,- a
directoryentry inpluginConfig.jsonto point at a local checkout in place of the oldlinkcommands.
Command replacements
| Old command | Replacement |
|---|---|
create-extension / create-mode | pnpm create ohif (Create an Extension or Mode) |
add-extension / add-mode | pnpm add -w <pkg> + a pluginConfig.json entry, or pnpm run plugin add <pkg> |
remove-extension / remove-mode | pnpm run plugin remove <pkg> |
link-extension / link-mode | directory entry in pluginConfig.json (pnpm run plugin link <path>) |
unlink-extension / unlink-mode | pnpm run plugin unlink <pkg> |
list | pnpm run plugin list |
search | npm search keywords:ohif-extension / npm search keywords:ohif-mode |
pnpm run plugin add still brings in a mode's extensions: it installs and
declares the OHIF extensions and modes the package lists as peers (--no-peers
to skip). plugin remove removes only the package you name;
pnpm run plugin doctor flags anything left missing or undeclared. See
Extension installation for the
from-npm, from-checkout, and in-tree forms of a registration entry.
Porting an extension or mode generated by the old CLI
An extension or mode scaffolded by the old CLI will not build or load as-is
under the current contract. The mechanical rewrites are done for you by
pnpm create ohif migrate ./path-to-your-plugin --dry-run, and the deep,
item-by-item walkthrough — with the CLI-era template quoted verbatim — lives in
CLI-era extension → 2026 plugin contract. The
short version:
-
Broken
devscript. The extension template's"dev"pointed at.webpack/webpack.dev.jsbut the template shipped only.webpack/webpack.prod.js; the mode template shipped no.webpack/directory at all. Re-scaffold withpnpm create ohifand movesrc/across, or, if you keep the old config, pointdevat the file that exists:- "dev": "cross-env NODE_ENV=development webpack --config .webpack/webpack.dev.js --watch --output-pathinfo",+ "dev": "cross-env NODE_ENV=development webpack --config .webpack/webpack.prod.js --watch --output-pathinfo", -
Drop the
@ohif/uiexternal. The template externalized@ohif/ui, a package that no longer exists (@ohif/ui-nextreplaced it). Align with the host contract instead:externals: [/\b(vtk.js)/, /\b(dcmjs)/, /\b(gl-matrix)/, /^@ohif/, /^@cornerstonejs/, 'react', 'react-dom', 'react/jsx-runtime', 'react-router', 'react-router-dom', 'i18next', 'react-i18next'],React was not external in the old templates' effective builds — adding it is the contract change. Never bundle React. React Router and i18next are new externals too: the viewer shares its copies, so a plugin uses the viewer's Router and translations.
-
Modern library shape. Replace the template's split
library:/library.typeoutput — which declaredlibrarytwice, so the old build never reliably emitted the UMD bundle it documented — with:output: { library: { name: pkg.name, type: 'umd' } }, -
Adopt
publishConfig. See Publish an Extension or Mode. Working-tree entries stay onsrc/*; the tarball entries are rewritten todist/*. Publish withpnpm publishonly — thenpmCLI ignores the rewrites. -
Early-3.13 template typo. If your scripts contain
pnpm rundev/pnpm runbuild, add the missing space. -
Keep the keywords.
ohif-extension/ohif-moderemain the discovery convention and are whatnpm searchandpnpm run plugin doctorkey off.
For the reasoning behind each rewrite — the duplicate output.library key, the
externals before/after, and the package.json shape — read the full
porting guide.
If your customizations live inside a fork of the Viewers repo rather than in a
standalone extension, see the De-forking guide for moving
them out into a plugin you register through pluginConfig.json.