Skip to main content

dynamicPluginsFeatureLoader

Home > @backstage/backend-dynamic-feature-service > dynamicPluginsFeatureLoader

A backend feature loader that fully enable backend dynamic plugins. More precisely it: - adds the dynamic plugins root service (typically depended upon by plugins), - adds additional required features to allow supporting dynamic plugins config schemas in the frontend application and the backend root logger, - uses the dynamic plugins service to discover and expose dynamic plugins as features.

Signature:

dynamicPluginsFeatureLoader: ((options?: DynamicPluginsFeatureLoaderOptions) => import("@backstage/backend-plugin-api").BackendFeature) & import("@backstage/backend-plugin-api").BackendFeature

Example 1

Using the dynamicPluginsFeatureLoader loader in a backend instance:

//...
import { createBackend } from '@backstage/backend-defaults';
import { dynamicPluginsFeatureLoader } from '@backstage/backend-dynamic-feature-service';

const backend = createBackend();
backend.add(dynamicPluginsFeatureLoader);
//...
backend.start();

Example 2

Passing options to the dynamicPluginsFeatureLoader loader in a backend instance:

//...
import { createBackend } from '@backstage/backend-defaults';
import { dynamicPluginsFeatureLoader } from '@backstage/backend-dynamic-feature-service';
import { myCustomModuleLoader } from './myCustomModuleLoader';
import { myCustomSchemaLocator } from './myCustomSchemaLocator';
import { myConfiguredLoggerOptions } from './myConfiguredLoggerOptions';

const backend = createBackend();
backend.add(dynamicPluginsFeatureLoader({
moduleLoader: myCustomModuleLoader,
schemaLocator: myCustomSchemaLocator,
logger: (config) => myConfiguredLoggerOptions(config),
}));
//...
backend.start();