UNPKG

@wroud/vite-plugin-ssg

Version:

A Vite plugin for static site generation (SSG) with React. Renders React applications to static HTML for faster load times and improved SEO.

29 lines 920 B
export function resolveHtmlTransforms(plugins) { const preHooks = []; const normalHooks = []; const postHooks = []; for (const plugin of plugins) { const hook = plugin.transformIndexHtml; if (!hook) continue; if (typeof hook === "function") { normalHooks.push(hook); } else { const order = hook.order ?? (hook.enforce === "pre" ? "pre" : undefined); // @ts-expect-error union type const handler = hook.handler ?? hook.transform; if (order === "pre") { preHooks.push(handler); } else if (order === "post") { postHooks.push(handler); } else { normalHooks.push(handler); } } } return [preHooks, normalHooks, postHooks]; } //# sourceMappingURL=resolveHtmlTransforms.js.map