I solved the problem in just 800 lines, and the performance matches C++ equivalents. The size is 19 KB uncompressed and 6 KB with gzip. And we use no third-party libraries — there are no dependencies at all.
Pathfinding in JavaScript
In the C++ world there are quite a few pathfinding libraries; the most popular one, in my opinion, is Recast & Detour. But even by reasonable standards it carries a lot of extra weight, it's quite large, and porting it to JavaScript makes it even bigger (1 MB). Since I understood how that library works, I decided to build my own almost from scratch rather than wrestle with porting. I based it on the
I solved the problem in just 800 lines, and the performance matches C++ equivalents. The size is 19 KB uncompressed and 6 KB with gzip. And we use no third-party libraries — there are no dependencies at all.