How do I change the order in which Meteor loads Javascript files? How do I change the order in which Meteor loads Javascript files? javascript javascript

How do I change the order in which Meteor loads Javascript files?


According to the Meteor documentation, files are currently loaded in this order:

  1. Files in [project_root]/lib are loaded first
  2. Files are sorted by directory depth. Deeper files are loaded first.
  3. Files are sorted in alphabetical order.
  4. main.* files are loaded last.

Source:http://docs.meteor.com/#structuringyourapp


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.


You can always us a JS loader like yepnope.js and add it to the client.js file. This works for me.