@dxos/app-framework - v0.8.3
    Preparing search index...

    Function lazy

    • Defines a lazy plugin whose body is loaded on first enable.

      The returned factory produces a stub Plugin that exposes meta synchronously (so callers can read Plugin.meta.id for free) but defers loading the real plugin's modules until the manager calls Plugin.resolveLazy. This lets the plugin's main entry point ship as a tiny meta-only chunk — the heavy capabilities, schema, React surfaces, etc. live behind the dynamic import() and become a separate Rollup chunk that is only fetched when the plugin is enabled.

      Type Parameters

      • T = void

      Parameters

      Returns PluginFactory<T>

      // plugin-markdown/src/index.ts
      import { Plugin } from '@dxos/app-framework';
      import { meta } from './meta';

      export const MarkdownPlugin = Plugin.lazy(meta, () => import('./MarkdownPlugin'));

      // plugin-markdown/src/MarkdownPlugin.tsx
      export const MarkdownPlugin = Plugin.define(meta).pipe(...heavy modules..., Plugin.make);
      export default MarkdownPlugin;