@sctg/vite-plugin-github-pages-spa
Version:
Vite plugin to enable SPA (Single Page Application) support for GitHub Pages
34 lines (32 loc) • 987 B
TypeScript
/**
* Options for the GitHub Pages SPA plugin
*/
interface GitHubPagesSpaOptions {
/**
* Whether to show warning messages in the console
* @default true
*/
verbose?: boolean;
/**
* Optional custom content for the 404.html file
* If provided, it will be used instead of the default template
*/
custom404Html?: string;
/**
* Whether to automatically add the script to index.html
* @default true
*/
injectScript?: boolean;
}
/**
* Creates a Vite plugin that adds support for Single Page Applications on GitHub Pages
*
* This plugin:
* 1. Creates a 404.html file that redirects all requests to the index.html
* 2. Injects a script into index.html that handles the redirect
*
* @param options Configuration options for the plugin
* @returns A Vite plugin
*/
declare function githubPagesSpa(options?: GitHubPagesSpaOptions): any;
export { type GitHubPagesSpaOptions, githubPagesSpa as default, githubPagesSpa };