From 19f39f7f65016520c4c6f9b92fbf269e9d8add7e Mon Sep 17 00:00:00 2001 From: Braden Wiggins <55504972+FractalHQ@users.noreply.github.com> Date: Thu, 16 Feb 2023 21:41:16 -0500 Subject: [PATCH] fix(ssr): print file url in `ssrTransform` parse error (#12060) --- packages/vite/src/node/ssr/ssrTransform.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/ssr/ssrTransform.ts b/packages/vite/src/node/ssr/ssrTransform.ts index 5fe2272d7fa4f7..996d4411153dc8 100644 --- a/packages/vite/src/node/ssr/ssrTransform.ts +++ b/packages/vite/src/node/ssr/ssrTransform.ts @@ -80,7 +80,9 @@ async function ssrTransformScript( if (!err.loc || !err.loc.line) throw err const line = err.loc.line throw new Error( - `Parse failure: ${err.message}\nContents of line ${line}: ${ + `Parse failure: ${ + err.message + }\nAt file: ${url}\nContents of line ${line}: ${ code.split('\n')[line - 1] }`, )