Skip to content

Commit 4309755

Browse files
authored
fix(ssr): use optional chaining to prevent "undefined is not an object" happening in ssrRewriteStacktrace (#19612)
1 parent 363d691 commit 4309755

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/vite/src/node/ssr/ssrStacktrace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function ssrRewriteStacktrace(
5252
return input
5353
}
5454

55-
const trimmedVarName = varName.trim()
55+
const trimmedVarName = varName?.trim()
5656
const sourceFile = path.resolve(path.dirname(id), pos.source)
5757
// stacktrace's column is 1-indexed, but sourcemap's one is 0-indexed
5858
const source = `${sourceFile}:${pos.line}:${pos.column + 1}`

0 commit comments

Comments
 (0)