Skip to content

Commit d4ae45d

Browse files
authored
feat: expose ssrRewriteStacktrace (#7091)
1 parent dddda1e commit d4ae45d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/vite/src/node/server/index.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,11 @@ export interface ViteDevServer {
229229
opts?: { fixStacktrace?: boolean }
230230
): Promise<Record<string, any>>
231231
/**
232-
* Fix ssr error stacktrace
232+
* Returns a fixed version of the given stack
233+
*/
234+
ssrRewriteStacktrace(stack: string): string
235+
/**
236+
* Mutates the given SSR error by rewriting the stacktrace
233237
*/
234238
ssrFixStacktrace(e: Error): void
235239
/**
@@ -386,6 +390,9 @@ export async function createServer(
386390
rebindErrorStacktrace(e, stacktrace)
387391
}
388392
},
393+
ssrRewriteStacktrace(stack: string) {
394+
return ssrRewriteStacktrace(stack, moduleGraph)
395+
},
389396
listen(port?: number, isRestart?: boolean) {
390397
return startServer(server, port, isRestart)
391398
},

0 commit comments

Comments
 (0)