Gobliins
Gobliins

Reputation: 4026

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. But it seems i need some NPM dependency to make this work in my package js.

Inside my 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?

Upvotes: 2

Views: 456

Answers (1)

kkkkkkk
kkkkkkk

Reputation: 7738

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.

To answer your question let try add ecmascript as your package's dependency:

Package.on_use(function (api) {
    // ...
    api.use(['http','accounts-base', 'ecmascript'], ['client', 'server']);
    // ....
});

Upvotes: 2

Related Questions