Pretty sure I could repeat the error - I spent about 2 hours yesterday trying to sort out the Syntax Errors I was getting.
ChatGPT mentioned that there should be Semi-Colons or New Lines in the ‘bad’ Javascript and all the errors I saw in the .js files were merged lines with no Semi-Colons.
At the moment, I am spending my efforts on getting the SPA correct. I now know this problem exists and I have a workaround.
However… Out of curiosity I have just tried the same actions as yesterday on the same Nodes as yesterday and it all works OK! I did try restarting Vivaldi yesterday, that made no difference, but I didn’t do a reboot. Maybe I was just unlucky, but I will keep my eye on it now I know about it!!
This is a Windows vs UNIX line ending issue. Very rare these days but can still happen. The paste operation has stripped the line endings or pasted them in a way that the recipient is not understanding. That will be why you are getting errors because without a newline and without a semi-colon statement separator, JavaScript cannot work out where each statement starts and ends.
I rarely get this issue, occasionally copying from some random website but not often. Try pasting as text rather than simply pasting to see if that makes a difference. Or even, as I sometimes have to, paste into VSCode or similar first and then re-copy and paste.