Skip to content

TypeScript API / @contentia/vite-plugin / ContentiaVitePluginOptions

Interface: ContentiaVitePluginOptions ​

Properties ​

defaultExtension? ​

ts
defaultExtension?: string;

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


dir? ​

ts
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
hmr?: 
  | boolean
  | {
  coarse?: boolean;
};

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


localApi? ​

ts
localApi?: boolean | ContentiaLocalApiOptions;

Mount Contentia'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 /__contentia 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
mdx?: boolean;

Write each item's body field out as an .mdx chunk under .contentia/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
repositories?: ContentiaRepositories;

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


serializers? ​

ts
serializers?: StorageSerializerRegistry;

Serializer registry for the default filesystem repository.


storage? ​

ts
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
typegen?: 
  | boolean
  | ContentiaTypegenPluginOptions;

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