This commit is contained in:
Rizky 2024-07-19 21:19:11 +07:00
parent b0c609e409
commit 54234cc3b4
3 changed files with 11 additions and 9 deletions

View File

@ -23,7 +23,7 @@ export const ensureLib = async (src_dir: string, id_site: string) => {
const config = site.config as any;
if (config.api_url) {
new URL(config.api_url);
const url = `${config.api_url}/_prasi/load.js?dev=1`;
const url = `${config.api_url}/_prasi/load.js?dev=1&v3&remote=1`;
const res = await fetch(url);
const apires = await res.text();
@ -32,7 +32,7 @@ export const ensureLib = async (src_dir: string, id_site: string) => {
const w = {} as any;
fn(w, { href: "http://127.0.0.1" });
const { prismaTypes } = w.prasiApi["http://127.0.0.1/"];
const { prismaTypes, apiTypes } = w.prasiApi["http://127.0.0.1/"];
for (const [k, v] of Object.entries(prismaTypes)) {
await Bun.write(dir.data(`${src_dir}/typings/${k}`), v as any);
}

View File

@ -2,11 +2,6 @@ import { Root as ReactRoot } from "react-dom/client";
import { Root } from "./base/root";
import { w } from "./utils/types/general";
import { isLocalhost } from "./utils/ui/is-localhost";
import { version } from "../timestamp";
const state = {
updating: false,
};
export const sworkerRegister = async (react: { root: null | ReactRoot }) => {
if (navigator.serviceWorker) {

View File

@ -99,8 +99,15 @@ export const serveStatic = {
});
}
if (g.mode === "dev" && url.pathname.endsWith(".js")) {
await this.walk();
if (url.pathname.endsWith(".js")) {
if (g.mode === "dev") {
await this.walk();
} else {
return new Response("", {
status: 404,
headers: { "content-type": "text/javascript" },
});
}
}
file = cache.static["/index.html"];