WOW ... it turns out the problem was somehow caused because I had the unit in a folder with other common units, and the folder was added to the library search path. When I explicitly added the unit to the project, it compiles just fine.
I've run into this before, but not as strange.
So I guess the moral of the story is ... don't rely on using the library search path to find units, but rather add them to the project explicitly.
Is this a bug or known problem with the pas2js compiler or something else?