google/santa-tracker-web

Closure files not working

Opened this issue · 10 comments

I'm trying to run Santa Tracker on my Windows 10 computer. I've fixed some errors, and everything's working except for the closure.js files on each scene, so I can't fully access scenes. Other virtual files work fine. Closure files just give 404 errors with no other logs. I tried to fix it with no success. Any idea of why does this happen?

(Sorry for all the edits, I thought config.json wasn't working but then I checked again and it did work, that's why I edited the title 3 times)

Is there any chance you can send us a fix for the other issues? Having the site work even without Closure on Windows would be a great start—there's only a handful of scenes which still use that.

My 2c, I wonder if we pass specific /'s into the Closure compiler that Windows doesn't like.

I'll try to find and send the fixes (I don't remember what did I edit to fix it 😅)

So, what I first did was add .posix to the require("path") in import-utils.js to fix the "unsupported on Windows" problem.
I also added the .posix in modern-vfs-middleware.js to fix most virtual files (like config.json) not working.
The last thing I did was removing the /st/ prefix on static paths to fix certain static js files (such as santa-error.js) going way too back and going outside /st/ in some requires, causing those required js files to not be loaded. (I'm pretty sure there's a much nicer workaround to this though)

Hope this helps!

Also, for some reason, the 4 background village svg layers you'd see at the start of the page are missing.

I fixed it! There were two problems:
Problem #1 is that santa-vfs, closure-compiler and closure-compiler-js make changes in paths, and since Windows uses \ instead of /, it breaks, so I added .posix to each require("path").
Problem #2 is that closurePlugin in santa-vfs gets the scene name and flags by the wrong m index (it uses m[1] and m[2] where it should be m[2] and m[3]), so I corrected it.

@SneezingCactus can you send a PR to fix this?

I would, but the problem is that in order to fix closure I'd have to modify closure-compiler and closure-compiler-js which are part of the google closure module, and I can't edit that (unless I can send a PR to the google closure repo)

I can send a PR for the other fixes though

Ok, I sent the PR