[英]SyntaxError: Unexpected reserved word 'export' in meteor package
So i have a meteor package which i modified a bit with this line:所以我有一个流星包,我用这行修改了一下:
export const myName = 'my-package'
the error i am getting is:我得到的错误是:
export const myName = 'my-package'
^^^^^^
SyntaxError: Unexpected reserved word
On my Meteor app i have the ECMAscript package installed.在我的 Meteor 应用程序上,我安装了 ECMAscript 包。 But it seems i need some NPM dependency to make this work in my package js.
但似乎我需要一些 NPM 依赖才能在我的包 js 中完成这项工作。
Inside my package.js:在我的 package.js 中:
Package.on_use(function (api) {
api.versionsFrom('1.1.0.2');
api.use(['routepolicy','webapp','underscore', 'service-configuration'], 'server');
api.use(['http','accounts-base'], ['client', 'server']);
api.add_files(['saml_server.js','saml_utils.js'], 'server');
api.add_files('saml_client.js', 'client');
});
Npm.depends({
"xml2js": "0.2.0",
"xml-crypto": "0.6.0",
"xmldom": "0.1.19",
"connect": "2.7.10",
"xmlbuilder": "2.6.4",
"querystring": "0.2.0",
"xml-encryption": "0.7.2",
});
Can someone help?有人可以帮忙吗?
It seems that your package has been developed for a long time with older version of Meteor so I suggest you stick with the old syntax and stay away from using ES6 module system within your package.似乎您的包已经使用旧版本的 Meteor 开发了很长时间,所以我建议您坚持使用旧语法并避免在您的包中使用 ES6 模块系统。
To answer your question let try add ecmascript
as your package's dependency:要回答您的问题,请尝试添加
ecmascript
作为您的包的依赖项:
Package.on_use(function (api) {
// ...
api.use(['http','accounts-base', 'ecmascript'], ['client', 'server']);
// ....
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.