one
Version:
One is a new React Framework that makes Vite serve both native and web.
24 lines (23 loc) • 908 B
JavaScript
import { getServerContext, useServerContext } from "../vite/one-server-only.mjs";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
function PreloadScripts() {
const serverContext = process.env.VITE_ENVIRONMENT === "client" ? getServerContext() : useServerContext(),
preloads = serverContext?.preloads || [],
deferredPreloads = serverContext?.deferredPreloads || [];
return /* @__PURE__ */jsxs(Fragment, {
children: [preloads.map(src => /* @__PURE__ */jsx("link", {
rel: "modulepreload",
href: src
}, `preload-${src}`)), preloads.map(src => /* @__PURE__ */jsx("script", {
type: "module",
src,
async: !0
}, `script-${src}`)), deferredPreloads.map(src => /* @__PURE__ */jsx("link", {
rel: "modulepreload",
fetchPriority: "low",
href: src
}, src))]
});
}
export { PreloadScripts };
//# sourceMappingURL=PreloadScripts.mjs.map