Function closures were first introduced on the server side (and only on the server) for two main reasons:
- Copied variables are a great way to avoid collisions of variables while saving simple variable names
- This was technically necessary for the
Npm.require function Npm.require
One of the features of Node / Meteor is the ability to run the same file on the client and on the server. That is why the variable scope must have the same behavior on both the client and server, and why Meteor now also includes closing functions on the client.
Unable to disable packaging (without changing the Meteor/tools code).
This will be improved in the near future thanks to work on the linker branch , which will automatically solve your file dependencies (based on variable names), and then 1. include javascript files in the correct order. 2. Export the variables that are needed to the global scope.
Now you have to manually export the objects that should be in the global area.
mquandalle
source share