Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 916 Bytes

createPlugin.md

File metadata and controls

43 lines (30 loc) · 916 Bytes

createPlugin

Taking a plugin config as argument and returns a new plugin.

Plugin Config

function createPlugin(config: PluginConfig): BackstagePlugin;

type PluginConfig = {
  id: string;
  register?(hooks: PluginHooks): void;
};

type PluginHooks = {
  router: RouterHooks;
};

Example Uses

Creating a basic plugin

Showcasing adding multiple routes, a feature flag and a redirect.

import { createPlugin } from '@backstage/core';
import ExampleComponent from './components/ExampleComponent';

export default createPlugin({
  id: 'new-plugin',
  register({ router, featureFlags }) {
    featureFlags.register('enable-example-component');

    router.registerRoute('/new-plugin', ExampleComponent);
  },
});

Back to References