导入 class 将在 meteor 中暴露文件的其他内容
importing class will exposed other content of the file in meteor
我在“/imports/api”目录中创建了一个文件。
这是文件中的简单内容,
export default class Account {
static get FUNCTIONS() {
return ...
}
constructor() {
this.prop1 = null;
}
...
}
if (Meteor.isServer) {
import ServerClass from './server';
Meteor.methods(...)
}
此文件导入到“/server”目录中。然后我使用
在客户端中导入了帐户 class
import Account from 'imports/api/Account'
它是否公开了 Meteor.isServer 中的服务器端代码(Meteor 方法和出版物)?
您从客户端导入的每个代码都将在客户端包中(但不一定是可执行的)。在您的情况下,用户将能够在网页的源文件中看到 Meteor.isServer
的代码块,但他将无法访问这部分的功能。
如果你写一个import语句inside a Meteor.isServer
那么这个import里面的代码也会是对客户不可见。
我在“/imports/api”目录中创建了一个文件。
这是文件中的简单内容,
export default class Account {
static get FUNCTIONS() {
return ...
}
constructor() {
this.prop1 = null;
}
...
}
if (Meteor.isServer) {
import ServerClass from './server';
Meteor.methods(...)
}
此文件导入到“/server”目录中。然后我使用
在客户端中导入了帐户 classimport Account from 'imports/api/Account'
它是否公开了 Meteor.isServer 中的服务器端代码(Meteor 方法和出版物)?
您从客户端导入的每个代码都将在客户端包中(但不一定是可执行的)。在您的情况下,用户将能够在网页的源文件中看到 Meteor.isServer
的代码块,但他将无法访问这部分的功能。
如果你写一个import语句inside a Meteor.isServer
那么这个import里面的代码也会是对客户不可见。