I've been having strange undefined errors as well.
First thing I've found out. It appears there have been some changes to the scoping of variables. Before a variable instantiated like myVar = "test"
, without a var
was globally visible. This no longer seems to be true, but on the up side we now can say global.myVar = "test"
and have it work fine everywhere except from the console. This is due the second change I've noticed today.
The console now seems to happen before the main script (and so before anything we write is defined) instead of after as it had be doing. I'm also seeing some console statements being issued multiple times at random intervals after being entered. It does not seem to happen for a console.log
issued at the console but when I started getting strange behavior, I added the following code at the very start of my main
module:
console.log('--')
if(global.test) console.log('from console', global.test);
From the console, issuing test = "a test"
just once results in the conditional being triggered once on the very next tick and then around a half dozen more times on random ticks latter. I was still collecting information when I saw your post.