Meteor-App:未定义跟踪器

时间:2015-09-08 21:16:31

标签: javascript meteor

我有一个像这样的流星包:

Package.describe({
    name: 'name:anything',
    summary: 'example package',
    version: '0.0.1',
    documentation: "README.md"
});

Package.onUse(function(api){
    api.versionsFrom('METEOR@1.1.0.3');

    api.use(['templating', 'mongo']);
    api.use(['iron:router@1.0.9'], 'client');

    api.addFiles(['lib/client/anything.js'], ['client']);

    api.export('App');

});

lib/client/anything.js中,我写了一行

App = {};
App.Mode = {};
App.Mode._dep = new Tracker.Dependency();

我在package.js中添加了anything.js文件并导出app-var - 就像你在上面看到的一样。

但我收到错误Uncaught ReferenceError: Tracker is not defined

那么我做错了什么?

1 个答案:

答案 0 :(得分:2)

tracker包需要在您的包中api.use d才能引用Tracker

api.use(['templating', 'mongo', 'tracker']);