Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

bootStackTraces.ts

16 lines602 Bytes

1let suspendedLimit: number | undefined;
2​
3// Skip Effect definition-site stack captures during production module evaluation.
4export function suspendStackTracesForAppImport(): void {
5 if (!import.meta.env.PROD || suspendedLimit !== undefined) return;
6 suspendedLimit = Error.stackTraceLimit;
7 Error.stackTraceLimit = 0;
8}
9​
10/** Called before main's startup code; returns true if the stacks were still suspended. */
11export function restoreStackTraces(): boolean {
12 if (suspendedLimit === undefined) return false;
13 Error.stackTraceLimit = suspendedLimit;
14 suspendedLimit = undefined;
15 return true;