import {
LocationProvider,
ErrorBoundary,
Router,
lazy,
hydrate,
prerender as ssr,
} from "preact-iso";
// @ts-expect-error
import pages from "dir:./pages";
const routes = (pages as string[]).map((name: string) => {
const filename = name.replace(/\.tsx$/, "");
const url = `/${filename.replace(/_index$/, "")}`;
const Route = lazy(() => import(`./pages/${filename}.tsx`));
console.log(url);
return { url, Route };
});
function App() {
return (
{routes.map(({ Route, url }) => (
))}
);
}
export async function prerender() {
return await ssr();
}
if (typeof window !== "undefined") {
hydrate(, document.body);
}