I got exact same problem on vs17.11.5 with BRAND NEW Blazor project. I just modified the contact form and now I got that JS error on the virtual page.
Since the virtual js is created on the fly when the project run, there is no way to debug or fix the file... hence it's a vs bug.