Relatude Help

The interface plugin

InterfacePlugin() gives the module a plugin for the CMS interface (chapter 20): an ES module whose default export is definePlugin(…), embedded in the module's assembly with the files it imports:

<EmbeddedResource Include="ui\**" LogicalName="cms-ui/%(RecursiveDir)%(Filename)%(Extension)" />
  • The entry, ui/index.js, can be plain JavaScript, with createElement in place of JSX and no build step, or TypeScript built with @relatude/plugin-kit. Without it, AddModule throws.
  • The CMS API serves the files at {api}/modules/{name}/{version}/…, and browsers cache them for good. The version is the assembly's informational version, unless the module overrides Version.
  • When it starts, the CMS interface asks for the site's modules (the cms-modules command) and imports the interface plugin of every active one. Bare imports, such as react, resolve to the interface's own copies.