diff --git a/app/srv/init.ts b/app/srv/init.ts index ce9e3a38..4b38ea37 100644 --- a/app/srv/init.ts +++ b/app/srv/init.ts @@ -1,8 +1,7 @@ +import { g } from "utils/global"; import { validate } from "uuid"; import { glb } from "./global"; import { server } from "./ws/sync/editor/code/server-main"; -import { g } from "utils/global"; -import { waitUntil } from "web-utils"; glb.npm = { page: {}, site: {} }; glb.ws_hook = { diff --git a/app/srv/ws/sync/editor/code/build-code.ts b/app/srv/ws/sync/editor/code/build-code.ts index 5a1f6bd4..80674bf5 100644 --- a/app/srv/ws/sync/editor/code/build-code.ts +++ b/app/srv/ws/sync/editor/code/build-code.ts @@ -149,11 +149,7 @@ if (typeof global.server_hook === "function") { server.init(id_site); }); }; - if (g.mode === "dev") { - setTimeout(reinit, 1000); - } else { - reinit(); - } + reinit(); }, }, ], diff --git a/app/srv/ws/sync/editor/code/server-main.ts b/app/srv/ws/sync/editor/code/server-main.ts index 148382d4..b219b984 100644 --- a/app/srv/ws/sync/editor/code/server-main.ts +++ b/app/srv/ws/sync/editor/code/server-main.ts @@ -39,13 +39,12 @@ const serverMain = () => ({ ); delete require.cache[server_src_path]; const svr = require(server_src_path); - if (svr && typeof svr.server === "object") { this.handler[site_id] = svr.server; this.handler[site_id].site_id = site_id; - if (typeof svr.init === "function") { - svr.init(); + if (typeof svr.server.init === "function") { + svr.server.init({}); } } diff --git a/package.json b/package.json index ac4b2a98..58ce780d 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "module": "src/index.ts", "type": "module", "scripts": { - "dev": "bun run --hot ./pkgs/core/index.ts dev", + "dev": "bun run ./pkgs/core/index.ts dev", "clean": "rm -rf data/lmdb && rm -rf app/static && rm -rf app/web/.parcel-cache", "build": "bun run --silent ./pkgs/core/build.ts", "build-site": "bun run --silent ./pkgs/core/build-site.ts",