Runtime Extensions
Runtime extensions let a deployment load prebuilt extension/mode bundles at
runtime with no viewer rebuild: entries in window.config.extensions and
window.config.modes may be descriptor objects instead of plain strings.
Everything on this page applies to modes as well: the runtimePluginOrigins
allowlist covers both, and each record in window.__ohif.runtimePlugins has a
kind of 'extension' or 'mode'.
window.config = {
// ...
extensions: [
{
packageName: '@acme/extension-foo', // MUST equal the extension id
importPath: '/plugins/extension-foo/index.umd.js',
globalName: '@acme/extension-foo', // UMD builds MUST set this; ESM builds MUST omit it
coreVersionRange: '>=3.13.0-beta.0 <4',
integrity: 'sha384-...', // required cross-origin
styles: ['/plugins/extension-foo/index.css'],
},
],
};
- Origins are deny-by-default: same-origin is implicit, anything else must
be listed in
window.config.runtimePluginOrigins. coreVersionRangeis checked against the host version fail-closed: a mismatch refuses the load before any network import.globalNameis a strict format discriminator — present means UMD (the loader returnswindow[globalName]), absent means ESM (the loader returns the module's default export). It is never defaulted topackageName.- Every attempt (success and failure) is recorded on
window.__ohif.runtimePlugins. integrityis enforced on this (descriptor) path only. Build-timepluginConfig.jsonimportPathentries are trusted outright, and the URL fallthrough /peerImportpath is gated by the origin allowlist alone — see Where integrity is enforced. For the commands that produce the value, see Computing theintegrityvalue.- CSP: a deployment that sets
CSP_HEADERmust extend the baseline, both for the viewer itself and for cross-origin plugins; see Content-Security-Policy (CSP_HEADER).
The normative reference for the descriptor fields, the
runtimePluginOrigins allowlist and the audit record shape is
Runtime Extensions and Modes
in the Configuration Files guide. CSP and CORS setup is covered in the
deployment guide under
Extending the baseline.
What the viewer does with a runtime plugin (how it loads it, what it checks,
which packages it shares, and how failures show) is specified in the
runtime plugins specification.