My Meteor methods call generic/utility type of methods that I don't want to keep redefining in each collection file. As long as the method remains inside of the collection file, the method is accessible. Once the method is moved to a different file, this error is generated: ReferenceError: myMethod is not defined
The collection file is located in: lib/collections/posts.js
If myMethod()
is located in this posts.js
file, it is accessible. If I create another file such as lib/_utils.js
and move myMethod()
there, it won't load. I intentionally added the underscore for it to load prior to the collection files.
The post titled Ordering of the css and js files loaded by Meteor explains the order in which the files are loaded, but something is still amiss. I'm guessing this is a security issue surrounding how Meteor methods work.
Can a Meteor method make a call to a method in another .js file? If so, where should this other .js file be located?
This question is answered in post Why can't my Meteor app recognize my function?