fix: Bun compatibility for build scripts and runtime detection

This commit is contained in:
Danila Poyarkov 2026-01-23 19:31:16 +03:00
parent 73734a23a1
commit 6d0c544e18
5 changed files with 12 additions and 8 deletions

View file

@ -8,7 +8,7 @@
// NEVER convert to top-level imports - breaks browser/Vite builds (web-ui)
let _randomBytes: typeof import("node:crypto").randomBytes | null = null;
let _http: typeof import("node:http") | null = null;
if (typeof process !== "undefined" && process.versions?.node) {
if (typeof process !== "undefined" && (process.versions?.node || process.versions?.bun)) {
import("node:crypto").then((m) => {
_randomBytes = m.randomBytes;
});