UNPKG

vite-plugin-mpa-plus

Version:

More flexible MPA (multipage application) supports html template

53 lines (49 loc) 1.35 kB
import { HtmlTagDescriptor, PluginOption } from 'vite'; import { Options as Options$1 } from 'ejs'; import historyApiFallback from 'connect-history-api-fallback'; interface InjectOptions { /** * @description Data injected into the html template */ data?: Record<string, any>; /** * @description Tag description */ tags?: HtmlTagDescriptor[]; /** * @description esj options configuration */ ejsOptions?: Options$1; } interface PageOption { entry?: string; filename?: string; template: string; inject?: InjectOptions; } declare type Pages = Record<string, PageOption>; declare type Rewrite = historyApiFallback.Rewrite; interface Options { /** * @description Page options */ pages?: Pages; /** * @description Page entry */ entry?: string; /** * @description Template path */ template?: string; /** * @description Inject options */ inject?: InjectOptions; /** * @description Implement path rewriting based on connect-history-api-fallback */ historyApiFallback?: historyApiFallback.Options; } declare function createPlugin(options: Options): PluginOption; export { InjectOptions, Options, PageOption, Pages, Rewrite, createPlugin as default };