Reputation: 281
The VSCode debugger always shows imports as undefined even when they're clearly not, why does it do this and is there a way I can fix it?
In below example, the variable "Lot" is imported and is not undefined as is demonstrated by the result of the console.log line, however when I manually type in "Lot" in the debugger it says it's undefined.
Screenshot with debugger and code
Code from example:
import Lot from '../db/models/Lot'
console.log(Lot === undefined) // prints false
console.log("break") // Debugger stopped at this breakpoint shows Lot as undefined
If I assign Lot to a local variable then it works:
const Lot2 = Lot
console.log("break") // Debugger stopped at this breakpoint shows Lot2 as defined
Upvotes: 5
Views: 1432