Reputation: 77
Here is a package.js file
Package.describe({
summary: 'Client Collection Paging Class designed for use with Meteor'
});
Package.on_use(function (api) {
api.use( 'underscore', [ 'client', 'server' ] ) ;
api.use( 'ejson', [ 'client', 'server' ] ) ;
api.add_files( 'lib/pageMan.js', 'client' ) ;
//api.add_files( 'lib/pageMan_publish.js', 'server' ) ;
//api.add_files( 'lib/pageMan_method.js', [ 'client', 'server' ] ) ;
if ( typeof api.export !== 'undefined' ) {
api.use( 'webapp', 'server' ) ;
Npm.depends( { connect: '2.7.10' } ) ;
api.export( 'Pager', 'client' ) ;
//api.export( 'methods', [ 'client', 'server' ] ) ;
//api.export('publish', 'server' ) ;
api.export( 'pagingUpdate', 'client' ) ;
api.export( 'pagingSubscribe', 'client' ) ;
api.export( 'pagingFirst', 'client' ) ;
api.export( 'pagingNext', 'client' ) ;
api.export( 'pagingPrev', 'client' ) ;
api.export( 'pagingLast', 'client' ) ;
} ;
});
I have a single Meteor.methods in /lib/pageMan_method.js and a single Meteor.publish in /lib/pageMan_publish.js If the code from these two files is placed in appropriate files in an example app the app works fine. I am trying to add them to my package but when I un-comment the 4 references in the packages.js file, the Server console reports
Object #<Object> has no method 'publish' or Object #<Object> has no method 'method'
I did try an api.use('meteor', ['client','server']
but no joy either.
Could someone please enlighten me if...
Upvotes: 2
Views: 877
Reputation: 75945
Make sure you use the livedata packages.
api.use( 'livedata', [ 'server' ] ) ;
Typically the packages have access to a very barebones version of meteor. (With absolutely no packages).
Upvotes: 2