UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

23 lines (22 loc) 959 B
import { Root } from "./Root.mjs"; import { resolveClientLoader } from "./clientLoaderResolver.mjs"; import { render } from "./render.mjs"; import { findRootLayout } from "./utils/findRootLayout.mjs"; import { jsx } from "react/jsx-runtime"; function createApp(options) { globalThis["__vxrnIsSPA"] = true; const setupComplete = options.getSetupPromise ? options.getSetupPromise() : Promise.resolve(); return setupComplete.then(() => findRootLayout(options.routes, options.routerRoot)).then(() => resolveClientLoader({})).then(() => { render(/* @__PURE__ */jsx(Root, { isClient: true, flags: options.flags, routes: options.routes, routerRoot: options.routerRoot, path: options.path || (typeof window !== "undefined" ? window.location.href : "/") })); }).catch(err => { console.error(`[one/headless] Error during initialization:`, err); }); } export { Root, createApp }; //# sourceMappingURL=headless.mjs.map