@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.
26 lines • 712 B
JavaScript
export class AppInstance {
index;
onAppStart;
onRoutesPrerender;
constructor(index, config) {
this.index = index;
this.onAppStart = config?.onAppStart;
this.onRoutesPrerender = config?.onRoutesPrerender;
}
async start(context) {
if (this.onAppStart) {
return await this.onAppStart(context);
}
return {
base: context.base ?? "/",
};
}
async getRoutesPrerender(startData) {
return (await this.onRoutesPrerender?.(startData)) ?? [];
}
async stop() { }
}
export function createAppConfig(index, config) {
return new AppInstance(index, config);
}
//# sourceMappingURL=AppInstance.js.map