@storm-software/workspace-tools
Version:
Tools for managing a Storm workspace, including various Nx generators and executors for common development tasks.
12 lines (9 loc) • 467 B
JavaScript
// 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?.src || new URL("main.js", document.baseURI).href;
export const importMetaUrl = /* @__PURE__ */ getImportMetaUrl();