From 941f1392a86e550d81f408745253a7b481d6f82b Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Fri, 25 Feb 2022 08:27:00 -0800 Subject: [PATCH] feat: expose ssrRewriteStacktrace --- packages/vite/src/node/server/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index aeea862dbc173f..f650456eb89aa0 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -226,7 +226,11 @@ export interface ViteDevServer { */ ssrLoadModule(url: string): Promise> /** - * Fix ssr error stacktrace + * Returns a fixed version of the given stack + */ + ssrRewriteStacktrace(stack: string): string + /** + * Mutates the given SSR error by rewriting the stacktrace */ ssrFixStacktrace(e: Error): void /** @@ -376,6 +380,9 @@ export async function createServer( rebindErrorStacktrace(e, stacktrace) } }, + ssrRewriteStacktrace(stack: string) { + return ssrRewriteStacktrace(stack, moduleGraph) + }, listen(port?: number, isRestart?: boolean) { return startServer(server, port, isRestart) },