How do I change the order in which Meteor loads Javascript files?
Solution 1:
According to the Meteor documentation, files are currently loaded in this order:
- Files in [project_root]/lib are loaded first
- Files are sorted by directory depth. Deeper files are loaded first.
- Files are sorted in alphabetical order.
- main.* files are loaded last.
Source: http://docs.meteor.com/#structuringyourapp
Solution 2:
Not a solution for all scenarios, but I think ideally anything that is dependent on other code would be placed in a Meteor.startup function, to ensure everything is already loaded.