Skip to content

TypeScript API / @laikacms/vite-plugin / LaikaVitePluginOptions

Interface: LaikaVitePluginOptions ​

Properties ​

defaultExtension? ​

ts
optional defaultExtension?: string;

File extension applied to keys without one. Defaults to 'json'.


dir? ​

ts
optional dir?: string;

Directory the default filesystem repository reads, resolved relative to the Vite project root. Ignored when storage/repositories is given. Defaults to 'content'.


hmr? ​

ts
optional hmr?: 
  | boolean
  | {
  coarse?: boolean;
};

Dev-server hot reload when content changes on disk. true (default) or { coarse } (invalidate every laika: module on any change); false disables it.


localApi? ​

ts
optional localApi?: boolean | LaikaLocalApiOptions;

Mount LaikaCMS's own JSON:API over this plugin's repositories while the Vite dev server is running ("local mode"), so a JSON:API client (e.g. the Decap admin) reads and writes content locally instead of a remote backend. true uses the default /__laika base path; pass an object to override it. Unauthenticated by design. Off by default — mounted only from the dev-server hook, so a production build/preview never exposes it.


mdx? ​

ts
optional mdx?: boolean;

Write each item's body field out as an .mdx chunk under .laika/vite-generated/bodies/ and re-export its default as Body, on top of the raw body string. This plugin does not compile MDX — pair it with a plugin that does (@mdx-js/rollup, ahead of your JSX plugin). Off by default.


repositories? ​

ts
optional repositories?: LaikaRepositories;

Bring your own repositories. When omitted, a filesystem storage repository (and Catalog documents and assets repositories derived from it) is created from LaikaVitePluginOptions.dir.


serializers? ​

ts
optional serializers?: StorageSerializerRegistry;

Serializer registry for the default filesystem repository.


storage? ​

ts
optional storage?: StorageRepository;

Provide only the storage repository; the documents and assets repositories are derived from it via Catalog. Ignored when repositories is given.


typegen? ​

ts
optional typegen?: boolean | LaikaTypegenPluginOptions;

Generate TypeScript declarations for laika: imports (the TS compiler infers them from the real content). true (default) or an options object; false disables typegen.

Released under the MIT License.