UNPKG

@wroud/vite-plugin-ssg

Version:

A Vite plugin for static site generation (SSG) with React. Renders React applications to static HTML for faster load times and improved SEO.

23 lines 657 B
export function deserializeError(obj) { const { name, message, stack, ...extras } = obj; // pick constructor by name (TypeError, RangeError, etc.), fallback to Error const Ctor = typeof name === "string" && typeof globalThis[name] === "function" ? globalThis[name] : Error; let error; try { error = new Ctor(message); } catch { error = new Error(message); if (name) error.name = name; } if (stack) { error.stack = stack; } // restore any extra properties Object.assign(error, extras); return error; } //# sourceMappingURL=deserializeError.js.map