// 修复 URL 报错问题 const root = globalThis.window === globalThis ? window.location.href : undefined; // 这里必须为 undefined,否则 node 端报错 export const createURL = (url: string | URL) => { if (typeof url === "string") { return new URL(url, root); } else { return url; } };