UNPKG

one

Version:

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

31 lines (30 loc) 1.04 kB
import { loadConfigFromFile } from "vite"; import "../polyfills-server.mjs"; function setOneOptions(next) { globalThis.__oneOptions = next; } function getUserOneOptions() { if (!globalThis.__oneOptions) throw new Error("One not loaded properly, is the one() plugin in your vite.config.ts?"); return globalThis.__oneOptions; } async function loadUserOneOptions(command, silent = !1) { const originalConsoleError = console.error; silent && (console.error = () => {}); try { const config = await loadConfigFromFile({ mode: command === "serve" ? "dev" : "prod", command }); if (!config) throw new Error(`No config config in ${process.cwd()}. Is this the correct directory?`); const oneOptions = getUserOneOptions(); if (!oneOptions) throw new Error("No One plugin config in this vite.config"); return { config, oneOptions }; } finally { silent && (console.error = originalConsoleError); } } export { loadUserOneOptions, setOneOptions }; //# sourceMappingURL=loadConfig.mjs.map