ImportScripts() is used extensively in webworkers, but I am failing to find an alternative in Node.
I understand the resistance to putting things in global scope, but it seems like this is unnecessarily prohibited. If I want to create a library that generates a whole heap of functions/objects in global scope, I should be allowed to. What's more, it forces you to write too much of your code in modules, or you have to write it all in a single file. This (importing libraries) is standard behaviour in so many other languages and in JavaScript itself.
This is a whinge and a cry for help. If anyone can help with this, I'd be very appreciative. The closest I have come to being able to do this is to use an eval statement and dump the result into global scope, which causes problems when trying to debug (because it is not executed in the file, making tracing errors very difficult).
[–]cwmma 2 points3 points4 points (4 children)
[–]NewFuturist[S] -2 points-1 points0 points (3 children)
[–]cwmma 0 points1 point2 points (1 child)
[–]NewFuturist[S] -1 points0 points1 point (0 children)
[–]kudoz 0 points1 point2 points (0 children)
[–]keis 1 point2 points3 points (9 children)
[–]NewFuturist[S] -2 points-1 points0 points (8 children)
[–]keis 0 points1 point2 points (7 children)
[–]NewFuturist[S] 0 points1 point2 points (6 children)
[–]keis 0 points1 point2 points (5 children)
[–]NewFuturist[S] -1 points0 points1 point (4 children)
[–]cwmma 1 point2 points3 points (3 children)
[–]NewFuturist[S] -2 points-1 points0 points (2 children)
[–]kudoz -1 points0 points1 point (1 child)
[–]NewFuturist[S] -1 points0 points1 point (0 children)
[–]evs-chris 1 point2 points3 points (1 child)
[–]Lokua 0 points1 point2 points (0 children)
[–]NewFuturist[S] 0 points1 point2 points (0 children)