Javascript 如何在Meteor中明确包含实体?
我想在我的用户上创建一个架构。这是我的目录结构Javascript 如何在Meteor中明确包含实体?,javascript,node.js,meteor,Javascript,Node.js,Meteor,我想在我的用户上创建一个架构。这是我的目录结构 Users -- collections.js -- helpers.js Players -- collections.js -- forms.js 但是,当我试图在Users/collections.js中包含Players/collections.js中的内容时,它表示它没有定义 Meteor.users.attachSchema(new SimpleSchema({ // irrelevent stuff up here "pro
Users
-- collections.js
-- helpers.js
Players
-- collections.js
-- forms.js
但是,当我试图在Users/collections.js
中包含Players/collections.js
中的内容时,它表示它没有定义
Meteor.users.attachSchema(new SimpleSchema({
// irrelevent stuff up here
"profiles.player": {
type: PlayerSchema, // playerschema is defined in Players/collections.js
optional: true
}
}));
我始终得到错误代码ReferenceError:PlayerSchema未定义
有没有办法在meteor的其他文件中显式包含某些实体
/lib/config/_namespace.js中添加一行:G={}
;
这将是您唯一一个不使用strict的文件
G.PlayerSchema=新的SimpleSchema(…
type:G.PlayerSchema
对于集合、模式、实用程序函数、常量和反应式词典等,这是一种很好的方法,不必打包所有内容。使用打包方法?是否必须使用打包方法,或者是否有其他方法?