Files
SnowLuma/.pnpm-store/v11/files/39/d2133fbec7ab3b0f50de29607e6f9dcb2b1e4a89528a75807abb71ba238165d83add88d0dfd36cd3f9657449a96e64c669fcc4366816043afa3adef439ee41
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

14 lines
569 B
Plaintext

// Shim globals in cjs bundle
// There's a weird bug that esbuild will always inject importMetaUrl
// if we export it as `const importMetaUrl = ... __filename ...`
// But using a function will not cause this issue
const getImportMetaUrl = () =>
typeof document === "undefined"
? new URL(`file:${__filename}`).href
: (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
? document.currentScript.src
: new URL("main.js", document.baseURI).href;
export const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()