Referencing otherwise unused variable inside catch {} strips out the variable outside try/catch, but leaves variable in catch untouched #2815
Labels
information needed
Further information is requested
Which project does this relate to?
Start
Describe the bug
I was unsure where to file the issue, I'm guessing it's probably a bundler or other downstream process that's causing this
In the stackblitz reproduction linked below, I have this file at
/routes/index.tsx
:I'm creating a variable that is unused other than inside the catch{} block. It seems like the
a
variable is being stripped out when rendering the page, but thea = 5
statement is still preserved, leading toReferenceError: a is not defined
Your Example Website or App
https://stackblitz.com/edit/github-avg9mj-mxdthn?file=app%2Froutes%2F__root.tsx,app%2Froutes%2Findex.tsx,app%2Fclient.tsx
Steps to Reproduce the Bug or Issue
npm run dev
Error in renderToPipeableStream: ReferenceError: a is not defined
Expected behavior
The
a
variable should not be stripped out, but instead realize thata = 5
in the catch block relies on thea
variableScreenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: