@adonisjs/inertia
Version:
Official Inertia.js adapter for AdonisJS
66 lines (65 loc) • 1.53 kB
TypeScript
import type { PluginOption } from 'vite';
/**
* Configuration options for the Inertia Vite plugin
*/
export type InertiaPluginOptions = {
/**
* Server-side rendering configuration
*/
ssr?: {
/**
* Whether or not to enable server-side rendering
*/
enabled: true;
/**
* The entrypoint for the server-side rendering
*/
entrypoint: string;
/**
* The output directory for the server-side rendering bundle
*/
output?: string;
} | {
enabled: false;
entrypoint?: string;
output?: string;
};
};
/**
* Inertia plugin for Vite that is tailored for AdonisJS
*
* Configures Vite for Inertia.js development with proper build settings,
* SSR support, and AdonisJS-specific optimizations.
*
* @param options - Configuration options for the plugin
* @returns Vite plugin configuration object
*
* @example
* ```js
* // Basic configuration
* import inertia from '@adonisjs/inertia/plugins/vite'
*
* export default defineConfig({
* plugins: [inertia()]
* })
* ```
*
* @example
* ```js
* // With SSR enabled
* import inertia from '@adonisjs/inertia/plugins/vite'
*
* export default defineConfig({
* plugins: [
* inertia({
* ssr: {
* enabled: true,
* entrypoint: 'inertia/ssr.tsx',
* output: 'build/ssr'
* }
* })
* ]
* })
* ```
*/
export default function inertia(options?: InertiaPluginOptions): PluginOption;