As I navigate through Meteor 1.3's include logic, I find myself facing a challenge.
In an app that I am currently piecing together, my /client/main.js file contains:
import '../imports/startup/accounts-config.js';
import '../imports/ui/body.js';
import '../imports/ui/home.js';
import '../imports/ui/map.js';
import '../imports/ui/admin.js';
...
Within /imports/ui/body.js, I have defined the following (utilizing flow router with mainLayout as the primary layout for rendering all other templates):
...
Template.mainLayout.onCreated(function mainLayoutOnCreated() {
Meteor.subscribe('tasks');
Meteor.subscribe('categories');
});
...
Additionally, I have crafted the subsequent function:
Template.admin.helpers({
categories() {
return Categories.find({}, { sort: { createdAt: -1 } });
},
});
When I place this function in /imports/ui/body.js, I successfully access 'categories' within the 'admin' template. However, upon relocating this function to /imports/ui/admin.js, an uninformative exception emerges in the javascript console:
Exception in template helper: categories@...
It baffles me how shifting the declaration of this helper function between files, both still included in the same 'main' file, leads to the throwing of an exception. Any insights on this?